From: Jérôme Glisse <jglisse@xxxxxxxxxx> When we get a page reference through get_user_page*() we want to keep track of that and bvec now has the ability to do so. Convert code to use bvec_set_gup_page() where appropriate. 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: Steve French <sfrench@xxxxxxxxx> Cc: linux-cifs@xxxxxxxxxxxxxxx Cc: samba-technical@xxxxxxxxxxxxxxx Cc: Ilya Dryomov <idryomov@xxxxxxxxx> Cc: Sage Weil <sage@xxxxxxxxxx> Cc: Alex Elder <elder@xxxxxxxxxx> Cc: ceph-devel@xxxxxxxxxxxxxxx --- fs/ceph/file.c | 3 +++ fs/cifs/misc.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d5561662b902..6c5b85f01721 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -104,6 +104,9 @@ static ssize_t __iter_get_bvecs(struct iov_iter *iter, size_t maxsize, min_t(int, bytes, PAGE_SIZE - start), start); + /* Is iov_iter_get_pages() using GUP ? */ + if (iov_iter_get_pages_use_gup(iter)) + bvec_set_gup_page(&bv, pages[idx]); bvecs[bvec_idx] = bv; bytes -= bv.bv_len; start = 0; diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index bc77a4a5f1af..e10d9f0f5874 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -883,7 +883,11 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) for (i = 0; i < cur_npages; i++) { len = rc > PAGE_SIZE ? PAGE_SIZE : rc; - bvec_set_page(&bv[npages + i], pages[i]); + /* Is iov_iter_get_pages() using GUP ? */ + if (iov_iter_get_pages_use_gup(iter)) + bvec_set_gup_page(&bv[npages + i], pages[i]); + else + bvec_set_page(&bv[npages + i], pages[i]); bv[npages + i].bv_offset = start; bv[npages + i].bv_len = len - start; rc -= len; -- 2.20.1