On 5/25/22 16:49, 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? > Warning about an infinite loop that can be recovered from only by rebooting the machine is not very useful... If max_append_sectors is zero and bio_iov_add_zone_append_page() is called, this is an error (stupid user) and everything should be failed with -ENOSUPP or -EIO. -- Damien Le Moal Western Digital Research