Thread (47 messages) 47 messages, 5 authors, 2023-03-31

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

From: Johannes Thumshirn <hidden>
Date: 2023-03-30 10:38:20
Also in: dm-devel, linux-block, linux-btrfs, linux-fsdevel, linux-mm

On 30.03.23 01:44, Damien Le Moal wrote:
On 3/30/23 02:06, Johannes Thumshirn wrote:
quoted
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 <redacted>
---
 drivers/md/raid1-10.c |  7 ++++++-
 drivers/md/raid10.c   | 12 ++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
index e61f6cad4e08..c21b6c168751 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.c
@@ -105,7 +105,12 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
 		 * won't fail because the vec table is big
 		 * enough to hold all these pages
 		 */
-		bio_add_page(bio, page, len, 0);
+		if (WARN_ON(!bio_add_page(bio, page, len, 0))) {
Not sure we really need the WARN_ON here...
Nevertheless,
I see it as a kind of assert(). It shouldn't fail but in theory it can.
Reviewed-by: Damien Le Moal <redacted>
Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help