Re: [Cluster-devel] [PATCH 18/19] dm-crypt: check if adding pages to clone bio fails

2023-03-29 Thread Damien Le Moal
On 3/30/23 09:17, Yang Shi wrote: > On Wed, Mar 29, 2023 at 4:49 PM Damien Le Moal > wrote: >> >> On 3/30/23 02:06, Johannes Thumshirn wrote: >>> Check if adding pages to clone bio fails and if bail out. >> >> Nope. The code retries with direct reclaim until it succeeds. Which is very >>

Re: [Cluster-devel] [PATCH 18/19] dm-crypt: check if adding pages to clone bio fails

2023-03-29 Thread Yang Shi
On Wed, Mar 29, 2023 at 4:49 PM Damien Le Moal wrote: > > On 3/30/23 02:06, Johannes Thumshirn wrote: > > Check if adding pages to clone bio fails and if bail out. > > Nope. The code retries with direct reclaim until it succeeds. Which is very > suspicious... It is not related to bio_add_page()

Re: [Cluster-devel] [PATCH 19/19] block: mark bio_add_page as __must_check

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > Now that all users of bio_add_page check for the return value, mark > bio_add_page as __must_check. > > Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research

Re: [Cluster-devel] return an ERR_PTR from __filemap_get_folio v2

2023-03-29 Thread Christoph Hellwig
On Tue, Mar 28, 2023 at 04:04:33PM -0700, Andrew Morton wrote: > > Note that the shmem patches in here are non-trivial and need some > > careful review and testing. > > How are we going with the review and testing. I assume that > we're now OK on the runtime testing front, but do you feel that >

Re: [Cluster-devel] [PATCH 18/19] dm-crypt: check if adding pages to clone bio fails

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > Check if adding pages to clone bio fails and if bail out. Nope. The code retries with direct reclaim until it succeeds. Which is very suspicious... > > This way we can mark bio_add_pages as __must_check. > > Signed-off-by: Johannes Thumshirn With

Re: [Cluster-devel] [PATCH 17/19] md: raid1: check if adding pages to resync bio fails

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > Check if adding pages to resync bio fails and if bail out. > > As the comment above suggests this cannot happen, WARN if it actually > happens. > > This way we can mark bio_add_pages as __must_check. > > Signed-off-by: Johannes Thumshirn > --- >

Re: [Cluster-devel] [PATCH 16/19] md: raid1: use __bio_add_page for adding single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > The sync request code uses bio_add_page() to add a page to a newly created > bio. > bio_add_page() can fail, but the return value is never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. >

Re: [Cluster-devel] [PATCH 15/19] md: check for failure when adding pages in alloc_behind_master_bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > alloc_behind_master_bio() can possibly add multiple pages to a bio, but it > is not checking for the return value of bio_add_page() if adding really > succeeded. > > Check if the page adding succeeded and if not bail out. > > Signed-off-by: Johannes

Re: [Cluster-devel] [PATCH 14/19] floppy: use __bio_add_page for adding single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:06, Johannes Thumshirn wrote: > The floppy code uses bio_add_page() to add a page to a newly created bio. > bio_add_page() can fail, but the return value is never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. > > This

Re: [Cluster-devel] [PATCH 13/19] zram: use __bio_add_page for adding single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The zram writeback code uses bio_add_page() to add a page to a newly > created bio. bio_add_page() can fail, but the return value is never > checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. >

Re: [Cluster-devel] [PATCH 12/19] zonefs: use __bio_add_page for adding single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The zonefs superblock reading code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is > never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to

Re: [Cluster-devel] [PATCH 11/19] gfs: use __bio_add_page for adding single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The GFS superblock reading code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to

Re: [Cluster-devel] [PATCH 10/19] jfs: logmgr: use __bio_add_page to add single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The JFS IO code uses bio_add_page() to add a page to a newly created bio. > bio_add_page() can fail, but the return value is never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. > > This

Re: [Cluster-devel] [PATCH 09/19] btrfs: raid56: use __bio_add_page to add single page

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The btrfs raid58 sector submission code uses bio_add_page() to add a page > to a newly created bio. bio_add_page() can fail, but the return value is > never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is >

Re: [Cluster-devel] [PATCH 08/19] btrfs: repair: use __bio_add_page for adding single page

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The btrfs repair bio submission code uses bio_add_page() to add a page to > a newly created bio. bio_add_page() can fail, but the return value is > never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed

Re: [Cluster-devel] [PATCH 07/19] md: raid5: use __bio_add_page to add single page to new bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The raid5-ppl submission code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. For adding consecutive pages, the return is actually checked and > a new bio is allocated if

Re: [Cluster-devel] [PATCH 05/19] md: use __bio_add_page to add single page

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The md-raid superblock writing code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed

Re: [Cluster-devel] [PATCH 03/19] dm: dm-zoned: use __bio_add_page for adding single metadata page

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > dm-zoned uses bio_add_page() for adding a single page to a freshly created > metadata bio. > > Use __bio_add_page() instead as adding a single page to a new bio is > always guaranteed to succeed. > > This brings us a step closer to marking

Re: [Cluster-devel] [PATCH 04/19] fs: buffer: use __bio_add_page to add single page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The buffer_head submission code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to

Re: [Cluster-devel] [PATCH 02/19] drbd: use __bio_add_page to add page to bio

2023-03-29 Thread Damien Le Moal
On 3/30/23 02:05, Johannes Thumshirn wrote: > The drbd code only adds a single page to a newly created bio. So use > __bio_add_page() to add the page which is guaranteed to succeed in this > case. > > This brings us closer to marking bio_add_page() as __must_check. > > Signed-off-by: Johannes

Re: [Cluster-devel] [PATCH 02/19] drbd: use __bio_add_page to add page to bio

2023-03-29 Thread Matthew Wilcox
On Wed, Mar 29, 2023 at 10:05:48AM -0700, Johannes Thumshirn wrote: > +++ b/drivers/block/drbd/drbd_bitmap.c > @@ -1043,9 +1043,11 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx > *ctx, int page_nr) __must_ho > bio = bio_alloc_bioset(device->ldev->md_bdev, 1, op, GFP_NOIO, >

[Cluster-devel] [PATCH 10/19] jfs: logmgr: use __bio_add_page to add single page to bio

2023-03-29 Thread Johannes Thumshirn
The JFS IO code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[Cluster-devel] [PATCH 00/19] bio: check return values of bio_add_page

2023-03-29 Thread Johannes Thumshirn
We have two functions for adding a page to a bio, __bio_add_page() which is used to add a single page to a freshly created bio and bio_add_page() which is used to add a page to an existing bio. While __bio_add_page() is expected to succeed, bio_add_page() can fail. This series converts the

[Cluster-devel] [PATCH 06/19] md: raid5-log: use __bio_add_page to add single page

2023-03-29 Thread Johannes Thumshirn
The raid5 log metadata submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 02/19] drbd: use __bio_add_page to add page to bio

2023-03-29 Thread Johannes Thumshirn
The drbd code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn --- drivers/block/drbd/drbd_bitmap.c | 8

[Cluster-devel] [PATCH 13/19] zram: use __bio_add_page for adding single page to bio

2023-03-29 Thread Johannes Thumshirn
The zram writeback code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page()

[Cluster-devel] [PATCH 14/19] floppy: use __bio_add_page for adding single page to bio

2023-03-29 Thread Johannes Thumshirn
The floppy code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[Cluster-devel] [PATCH 19/19] block: mark bio_add_page as __must_check

2023-03-29 Thread Johannes Thumshirn
Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index

[Cluster-devel] [PATCH 18/19] dm-crypt: check if adding pages to clone bio fails

2023-03-29 Thread Johannes Thumshirn
Check if adding pages to clone bio fails and if bail out. This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn --- drivers/md/dm-crypt.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c

[Cluster-devel] [PATCH 15/19] md: check for failure when adding pages in alloc_behind_master_bio

2023-03-29 Thread Johannes Thumshirn
alloc_behind_master_bio() can possibly add multiple pages to a bio, but it is not checking for the return value of bio_add_page() if adding really succeeded. Check if the page adding succeeded and if not bail out. Signed-off-by: Johannes Thumshirn --- drivers/md/raid1.c | 3 ++- 1 file

[Cluster-devel] [PATCH 08/19] btrfs: repair: use __bio_add_page for adding single page

2023-03-29 Thread Johannes Thumshirn
The btrfs repair bio submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 16/19] md: raid1: use __bio_add_page for adding single page to bio

2023-03-29 Thread Johannes Thumshirn
The sync request code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[Cluster-devel] [PATCH 05/19] md: use __bio_add_page to add single page

2023-03-29 Thread Johannes Thumshirn
The md-raid superblock writing code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 11/19] gfs: use __bio_add_page for adding single page to bio

2023-03-29 Thread Johannes Thumshirn
The GFS superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 12/19] zonefs: use __bio_add_page for adding single page to bio

2023-03-29 Thread Johannes Thumshirn
The zonefs superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 17/19] md: raid1: check if adding pages to resync bio fails

2023-03-29 Thread Johannes Thumshirn
Check if adding pages to resync bio fails and if bail out. As the comment above suggests this cannot happen, WARN if it actually happens. This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn --- drivers/md/raid1-10.c | 7 ++- drivers/md/raid10.c | 12

[Cluster-devel] [PATCH 09/19] btrfs: raid56: use __bio_add_page to add single page

2023-03-29 Thread Johannes Thumshirn
The btrfs raid58 sector submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 03/19] dm: dm-zoned: use __bio_add_page for adding single metadata page

2023-03-29 Thread Johannes Thumshirn
dm-zoned uses bio_add_page() for adding a single page to a freshly created metadata bio. Use __bio_add_page() instead as adding a single page to a new bio is always guaranteed to succeed. This brings us a step closer to marking bio_add_page() __must_check Signed-off-by: Johannes Thumshirn ---

[Cluster-devel] [PATCH 07/19] md: raid5: use __bio_add_page to add single page to new bio

2023-03-29 Thread Johannes Thumshirn
The raid5-ppl submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. For adding consecutive pages, the return is actually checked and a new bio is allocated if adding the page fails. Use __bio_add_page() as adding

[Cluster-devel] [PATCH 04/19] fs: buffer: use __bio_add_page to add single page to bio

2023-03-29 Thread Johannes Thumshirn
The buffer_head submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[Cluster-devel] [PATCH 01/19] swap: use __bio_add_page to add page to bio

2023-03-29 Thread Johannes Thumshirn
The swap code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn --- mm/page_io.c | 8 1 file changed, 4

[Cluster-devel] [RFC PATCH v2 39/48] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage

2023-03-29 Thread David Howells
When transmitting data, call down a layer using a single sendmsg with MSG_SPLICE_PAGES to indicate that content should be spliced rather using sendpage. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David