Re: [PATCH v1 15/15] ceph: use put_user_pages() instead of ceph_put_page_vector()

From: Jerome Glisse
Date: Mon Apr 15 2019 - 11:12:06 EST


On Mon, Apr 15, 2019 at 03:46:59PM +0800, Yan, Zheng wrote:
> On 4/12/19 5:08 AM, jglisse@xxxxxxxxxx wrote:
> > From: Jérôme Glisse <jglisse@xxxxxxxxxx>
> >
> > When page reference were taken through GUP (get_user_page*()) we need
> > to drop them with put_user_pages().
> >
> > Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx>
> > Cc: linux-fsdevel@xxxxxxxxxxxxxxx
> > Cc: linux-block@xxxxxxxxxxxxxxx
> > Cc: linux-mm@xxxxxxxxx
> > Cc: John Hubbard <jhubbard@xxxxxxxxxx>
> > Cc: Jan Kara <jack@xxxxxxx>
> > Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> > Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
> > Cc: Johannes Thumshirn <jthumshirn@xxxxxxx>
> > Cc: Christoph Hellwig <hch@xxxxxx>
> > Cc: Jens Axboe <axboe@xxxxxxxxx>
> > Cc: Ming Lei <ming.lei@xxxxxxxxxx>
> > Cc: Dave Chinner <david@xxxxxxxxxxxxx>
> > Cc: Jason Gunthorpe <jgg@xxxxxxxx>
> > Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> > Cc: Yan Zheng <zyan@xxxxxxxxxx>
> > Cc: Sage Weil <sage@xxxxxxxxxx>
> > Cc: Ilya Dryomov <idryomov@xxxxxxxxx>
> > Cc: ceph-devel@xxxxxxxxxxxxxxx
> > ---
> > fs/ceph/file.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> > index 6c5b85f01721..5842ad3a4218 100644
> > --- a/fs/ceph/file.c
> > +++ b/fs/ceph/file.c
> > @@ -667,7 +667,8 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to,
> > } else {
> > iov_iter_advance(to, 0);
> > }
> > - ceph_put_page_vector(pages, num_pages, false);
> > + /* iov_iter_get_pages_alloc() did call GUP */
> > + put_user_pages(pages, num_pages);
>
> pages in pipe were not from get_user_pages(). Am I missing anything?

Oh my mistake i miss-read iov_iter_is_pipe() and iov_iter_get_pages_alloc()
missed the special case for pipe before iterate_all_kinds() Thanks for
catching that.

Cheers,
Jérôme