On Wed, May 25, 2022 at 09:49:41AM +0200, Pankaj Raghav wrote: > On Tue, May 24, 2022 at 09:38:32AM -0600, Keith Busch wrote: > > On Tue, May 24, 2022 at 04:17:54PM +0200, Pankaj Raghav wrote: > > > On Mon, May 23, 2022 at 02:01:14PM -0700, Keith Busch wrote: > > > > - if (WARN_ON_ONCE(!max_append_sectors)) > > > > - return 0; > > > I don't see this check in the append path. Should it be added in > > > bio_iov_add_zone_append_page() function? > > > > I'm not sure this check makes a lot of sense. If it just returns 0 here, then > > won't that get bio_iov_iter_get_pages() stuck in an infinite loop? The bio > > isn't filling, the iov isn't advancing, and 0 indicates keep-going. > Yeah but if max_append_sectors is zero, then bio_add_hw_page() also > returns 0 as follows: > .... > if (((bio->bi_iter.bi_size + len) >> 9) > max_sectors) > return 0; > .... > With WARN_ON_ONCE, we at least get a warning message if it gets stuck in an > infinite loop because of max_append_sectors being zero right? The return for this function is the added length, not an indicator of success. And we already handle '0' as an error from bio_iov_add_zone_append_page(): if (bio_add_hw_page(q, bio, page, len, offset, queue_max_zone_append_sectors(q), &same_page) != len) return -EINVAL;