From: Johannes Thumshirn <jth@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com, hch@lst.de,
martin.petersen@oracle.com, hare@suse.de,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH] btrfs: handle bio_split() error
Date: Tue, 29 Oct 2024 10:11:21 +0100 [thread overview]
Message-ID: <20241029091121.16281-1-jth@kernel.org> (raw)
In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com>
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Now that bio_split() can return errors, add error handling for it in
btrfs_split_bio() and ultimately btrfs_submit_chunk().
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
John,
in case you have to send a v3, can you please include this one in your series?
fs/btrfs/bio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 1f216d07eff6..96cacd5c03a5 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -81,6 +81,9 @@ static struct btrfs_bio *btrfs_split_bio(struct btrfs_fs_info *fs_info,
bio = bio_split(&orig_bbio->bio, map_length >> SECTOR_SHIFT, GFP_NOFS,
&btrfs_clone_bioset);
+ if (IS_ERR(bio))
+ return ERR_CAST(bio);
+
bbio = btrfs_bio(bio);
btrfs_bio_init(bbio, fs_info, NULL, orig_bbio);
bbio->inode = orig_bbio->inode;
@@ -687,6 +690,10 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
if (map_length < length) {
bbio = btrfs_split_bio(fs_info, bbio, map_length);
+ if (IS_ERR(bbio)) {
+ ret = PTR_ERR(bbio);
+ goto fail;
+ }
bio = &bbio->bio;
}
--
2.43.0
next prev parent reply other threads:[~2024-10-29 9:11 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 15:27 [PATCH v2 0/7] bio_split() error handling rework John Garry
2024-10-28 15:27 ` [PATCH v2 1/7] block: Use BLK_STS_OK in bio_init() John Garry
2024-10-28 16:11 ` Christoph Hellwig
2024-10-28 16:32 ` John Garry
2024-10-28 15:27 ` [PATCH v2 2/7] block: Rework bio_split() return value John Garry
2024-10-28 16:12 ` Christoph Hellwig
2024-10-29 9:12 ` Johannes Thumshirn
2024-10-28 15:27 ` [PATCH v2 3/7] block: Error an attempt to split an atomic write in bio_split() John Garry
2024-10-28 16:12 ` Christoph Hellwig
2024-10-29 9:12 ` Johannes Thumshirn
2024-10-28 15:27 ` [PATCH v2 4/7] block: Handle bio_split() errors in bio_submit_split() John Garry
2024-10-28 16:12 ` Christoph Hellwig
2024-10-29 9:13 ` Johannes Thumshirn
2024-10-28 15:27 ` [PATCH v2 5/7] md/raid0: Handle bio_split() errors John Garry
2024-10-29 3:52 ` Yu Kuai
2024-10-28 15:27 ` [PATCH v2 6/7] md/raid1: " John Garry
2024-10-29 3:48 ` Yu Kuai
2024-10-29 8:45 ` John Garry
2024-10-29 11:30 ` Yu Kuai
2024-10-29 11:36 ` John Garry
2024-10-29 11:32 ` Yu Kuai
2024-10-29 12:12 ` Yu Kuai
2024-10-29 12:21 ` John Garry
2024-10-28 15:27 ` [PATCH v2 7/7] md/raid10: " John Garry
2024-10-29 11:55 ` Yu Kuai
2024-10-29 12:05 ` John Garry
2024-10-29 12:10 ` Yu Kuai
2024-10-29 9:11 ` Johannes Thumshirn [this message]
2024-10-29 10:33 ` [PATCH] btrfs: handle bio_split() error John Garry
2024-10-30 14:00 ` kernel test robot
2024-10-30 14:06 ` Johannes Thumshirn
2024-10-30 14:20 ` John Garry
2024-10-30 14:29 ` Johannes Thumshirn
2024-10-30 20:05 ` Dan Carpenter
2024-10-31 9:29 ` John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241029091121.16281-1-jth@kernel.org \
--to=jth@kernel.org \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=song@kernel.org \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox