Message ID | 1593704330-11540-2-git-send-email-joshi.k@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix/extend zone-append in block-layer | expand |
On 2020/07/03 0:42, Kanchan Joshi wrote: > avoid returning success when it should report failure, preventing > odd behavior in caller. You can be more precise here: the odd behavior is an infinite loop in bio_iov_iter_get_pages() whcih is is the only user of __bio_iov_append_get_pages(). > > Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> > Signed-off-by: Selvakumar S <selvakuma.s1@samsung.com> > Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> > Signed-off-by: Javier Gonzalez <javier.gonz@samsung.com> > --- > block/bio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/bio.c b/block/bio.c > index a7366c0..0cecdbc 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -1044,7 +1044,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter) > size_t offset; > > if (WARN_ON_ONCE(!max_append_sectors)) > - return 0; > + return -EINVAL; > > /* > * Move page array up in the allocated memory for the bio vecs as far as > Note: the odd behavior mentioned in the commit message cannot currently be triggered since only zonefs issues REQ_OP_ZONE_APPEND BIOs so we are guaranteed that max_append_sectors is not 0 in that case. But this fix certainly makes things more solid. So: Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
On Fri, Jul 03, 2020 at 05:29:50AM +0000, Damien Le Moal wrote: >On 2020/07/03 0:42, Kanchan Joshi wrote: >> avoid returning success when it should report failure, preventing >> odd behavior in caller. > >You can be more precise here: the odd behavior is an infinite loop in >bio_iov_iter_get_pages() whcih is is the only user of __bio_iov_append_get_pages(). Sure. Kept that in cover letter, but missed here. >> >> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> >> Signed-off-by: Selvakumar S <selvakuma.s1@samsung.com> >> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> >> Signed-off-by: Javier Gonzalez <javier.gonz@samsung.com> >> --- >> block/bio.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/block/bio.c b/block/bio.c >> index a7366c0..0cecdbc 100644 >> --- a/block/bio.c >> +++ b/block/bio.c >> @@ -1044,7 +1044,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter) >> size_t offset; >> >> if (WARN_ON_ONCE(!max_append_sectors)) >> - return 0; >> + return -EINVAL; >> >> /* >> * Move page array up in the allocated memory for the bio vecs as far as >> > >Note: the odd behavior mentioned in the commit message cannot currently be >triggered since only zonefs issues REQ_OP_ZONE_APPEND BIOs so we are guaranteed >that max_append_sectors is not 0 in that case. But this fix certainly makes >things more solid. So: Yes, zonefs will not run into this. Future users of zone-append may. I encountered this endless loop while testing user zone-append path. >Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> > >-- >Damien Le Moal >Western Digital Research >
diff --git a/block/bio.c b/block/bio.c index a7366c0..0cecdbc 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1044,7 +1044,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter) size_t offset; if (WARN_ON_ONCE(!max_append_sectors)) - return 0; + return -EINVAL; /* * Move page array up in the allocated memory for the bio vecs as far as