Skip to content

Commit ce3030e

Browse files
chencheng-fnnasgregkh
authored andcommitted
md/raid10: reset read_slot when reusing r10bio for discard
[ Upstream commit 6b8a26a ] put_all_bios() always drops devs[i].bio, but it only drops devs[i].repl_bio when r10_bio->read_slot < 0. If discard reuses an r10bio that was previously used for a read, read_slot can still be non-negative, and discard cleanup can skip bio_put() on repl_bio. Reset read_slot to -1 when preparing an r10bio for discard so the replacement bio is always released correctly. Fixes: d30588b ("md/raid10: improve raid10 discard request") Signed-off-by: Chen Cheng <chencheng@fnnas.com> Reviewed-by: Xiao Ni <xiao@kernel.org> Link: https://patch.msgid.link/20260515093019.3436882-1-chencheng@fnnas.com Signed-off-by: Yu Kuai <yukuai@fygo.io> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 964a44a commit ce3030e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/md/raid10.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,7 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
17441744
r10_bio->mddev = mddev;
17451745
r10_bio->state = 0;
17461746
r10_bio->sectors = 0;
1747+
r10_bio->read_slot = -1;
17471748
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * geo->raid_disks);
17481749
wait_blocked_dev(mddev, r10_bio);
17491750

0 commit comments

Comments
 (0)