Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557374

Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph splice codepaths

From Ilya Dryomov <idryomov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph splice codepaths
Date 2017-01-12 12:20 +0100
Message-ID <sYLAe-3jp-35@gated-at.bofh.it> (permalink)
References <sWHr4-5KI-29@gated-at.bofh.it> <sY4bU-1qK-7@gated-at.bofh.it> <sYICm-1zl-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 12, 2017 at 8:59 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Tue, Jan 10, 2017 at 07:57:31AM -0500, Jeff Layton wrote:
>> v2: fix bug in offset handling in iov_iter_pvec_size
>>
>> xfstest generic/095 triggers soft lockups in kcephfs. Basically it uses
>> fio to drive some I/O via vmsplice ane splice. Ceph then ends up trying
>> to access an ITER_BVEC type iov_iter as a ITER_IOVEC one. That causes it
>> to pick up a wrong offset and get stuck in an infinite loop while trying
>> to populate the page array. dio_get_pagev_size has a similar problem.
>>
>> To fix the first problem, add a new iov_iter helper to determine the
>> offset into the page for the current segment and have ceph call that.
>> I would just replace dio_get_pages_alloc with iov_iter_get_pages_alloc,
>> but that will only return a single page at a time for ITER_BVEC and
>> it's better to make larger requests when possible.
>>
>> For the second problem, we simply replace it with a new helper that does
>> what it does, but properly for all iov_iter types.
>>
>> Since we're moving that into generic code, we can also utilize the
>> iterate_all_kinds macro to simplify this. That means that we need to
>> rework the logic a bit since we can't advance to the next vector while
>> checking the current one.
>
> Yecchhh...  That really looks like exposing way too low-level stuff instead
> of coming up with saner primitive ;-/
>
> Is page vector + offset in the first page + number of bytes really what
> ceph wants?  Would e.g. an array of bio_vec be saner?  Because _that_
> would make a lot more natural iov_iter_get_pages_alloc() analogue...
>
> And yes, I realize that you have ->pages wired into the struct ceph_osd_request;
> how painful would it be to have it switched to struct bio_vec array instead?

It would be a significant and wide-reaching change, but I've been
meaning to look into switching to iov_iter for a couple of releases
now.  There is a lot of ugly code in net/ceph/messenger.c to hangle
iteration over "page vectors", "page lists" and "bio lists".  All of it
predates iov_iter proliferation and is mostly incomplete anyway: IIRC
you can send out of a pagelist but can't recv into a pagelist, etc.

That said, Jeff's patch doesn't look too bad to me...

Thanks,

                Ilya

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ceph/iov_iter: fix bad iov_iter handling in ceph splice codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-06 19:30 +0100
  Re: [PATCH] ceph/iov_iter: fix bad iov_iter handling in ceph splice  codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-06 21:40 +0100
  Re: [PATCH] ceph/iov_iter: fix bad iov_iter handling in ceph splice  codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-10 00:20 +0100
  [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph splice codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-10 14:00 +0100
    Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths "Yan, Zheng" <zyan@redhat.com> - 2017-01-11 03:50 +0100
    Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Al Viro <viro@ZenIV.linux.org.uk> - 2017-01-12 09:10 +0100
      Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Ilya Dryomov <idryomov@gmail.com> - 2017-01-12 12:20 +0100
        Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Al Viro <viro@ZenIV.linux.org.uk> - 2017-01-12 12:40 +0100
          Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Ilya Dryomov <idryomov@gmail.com> - 2017-01-12 12:50 +0100
            Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-12 13:00 +0100
            Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Al Viro <viro@ZenIV.linux.org.uk> - 2017-01-12 13:00 +0100
              Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Ilya Dryomov <idryomov@gmail.com> - 2017-01-12 13:20 +0100
      Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Jeff Layton <jlayton@redhat.com> - 2017-01-12 12:30 +0100
        Re: [PATCH v2] ceph/iov_iter: fix bad iov_iter handling in ceph  splice codepaths Ilya Dryomov <idryomov@gmail.com> - 2017-01-12 12:40 +0100

csiph-web