Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/raid10: add a new r10bio flag R10BIO_Returned

The new helper bio_submit_split_bioset() can failed the orginal bio on
split errors, prepare to handle this case in raid_end_bio_io().

The flag name is refer to the r1bio flag name.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Yu Kuai and committed by
Jens Axboe
deeeab30 a6fcc160

+7 -3
+5 -3
drivers/md/raid10.c
··· 322 322 struct bio *bio = r10_bio->master_bio; 323 323 struct r10conf *conf = r10_bio->mddev->private; 324 324 325 - if (!test_bit(R10BIO_Uptodate, &r10_bio->state)) 326 - bio->bi_status = BLK_STS_IOERR; 325 + if (!test_and_set_bit(R10BIO_Returned, &r10_bio->state)) { 326 + if (!test_bit(R10BIO_Uptodate, &r10_bio->state)) 327 + bio->bi_status = BLK_STS_IOERR; 328 + bio_endio(bio); 329 + } 327 330 328 - bio_endio(bio); 329 331 /* 330 332 * Wake up any possible resync thread that waits for the device 331 333 * to go idle.
+2
drivers/md/raid10.h
··· 165 165 * so that raid10d knows what to do with them. 166 166 */ 167 167 R10BIO_ReadError, 168 + /* For bio_split errors, record that bi_end_io was called. */ 169 + R10BIO_Returned, 168 170 /* If a write for this request means we can clear some 169 171 * known-bad-block records, we set this flag. 170 172 */