Message ID | 1525364581-27065-1-git-send-email-idryomov@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, May 4, 2018 at 12:23 AM, Ilya Dryomov <idryomov@gmail.com> wrote: > rsize/wsize cap should be applied before ceph_osdc_new_request() is > called. Otherwise, if the size is limited by the cap instead of the > stripe unit, ceph_osdc_new_request() would setup an extent op that is > bigger than what dio_get_pages_alloc() would pin and add to the page > vector, triggering asserts in the messenger. > > Cc: stable@vger.kernel.org > Fixes: 95cca2b44e54 ("ceph: limit osd write size") > Signed-off-by: Ilya Dryomov <idryomov@gmail.com> > --- > fs/ceph/file.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/ceph/file.c b/fs/ceph/file.c > index f85040d73e3d..8ce7849f3fbd 100644 > --- a/fs/ceph/file.c > +++ b/fs/ceph/file.c > @@ -918,6 +918,11 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, > size_t start = 0; > ssize_t len; > > + if (write) > + size = min_t(u64, size, fsc->mount_options->wsize); > + else > + size = min_t(u64, size, fsc->mount_options->rsize); > + > vino = ceph_vino(inode); > req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, > vino, pos, &size, 0, > @@ -933,11 +938,6 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, > break; > } > > - if (write) > - size = min_t(u64, size, fsc->mount_options->wsize); > - else > - size = min_t(u64, size, fsc->mount_options->rsize); > - > len = size; > pages = dio_get_pages_alloc(iter, len, &start, &num_pages); > if (IS_ERR(pages)) { > -- > 2.4.3 > Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Regards Yan, Zheng > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index f85040d73e3d..8ce7849f3fbd 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -918,6 +918,11 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, size_t start = 0; ssize_t len; + if (write) + size = min_t(u64, size, fsc->mount_options->wsize); + else + size = min_t(u64, size, fsc->mount_options->rsize); + vino = ceph_vino(inode); req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino, pos, &size, 0, @@ -933,11 +938,6 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, break; } - if (write) - size = min_t(u64, size, fsc->mount_options->wsize); - else - size = min_t(u64, size, fsc->mount_options->rsize); - len = size; pages = dio_get_pages_alloc(iter, len, &start, &num_pages); if (IS_ERR(pages)) {
rsize/wsize cap should be applied before ceph_osdc_new_request() is called. Otherwise, if the size is limited by the cap instead of the stripe unit, ceph_osdc_new_request() would setup an extent op that is bigger than what dio_get_pages_alloc() would pin and add to the page vector, triggering asserts in the messenger. Cc: stable@vger.kernel.org Fixes: 95cca2b44e54 ("ceph: limit osd write size") Signed-off-by: Ilya Dryomov <idryomov@gmail.com> --- fs/ceph/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)