Skip to content

Commit 17a3273

Browse files
mgmlmepeluse
authored andcommitted
md/raid1,raid10: don't broken array on failfast metadata write fails
It is not intended for the array to fail when a metadata write with MD_FAILFAST fails. After commit 9631abd ("md: Set MD_BROKEN for RAID1 and RAID10"), when md_error is called on the last device in RAID1/10, the MD_BROKEN flag is set on the array. Because of this, a failfast metadata write failure will make the array "broken" state. If rdev is not Faulty even after calling md_error, the rdev is the last device, and there is nothing except MD_BROKEN that prevents writes to the array. Therefore, by clearing MD_BROKEN, the array will not become "broken" after a failfast metadata write failure. Fixes: 9631abd ("md: Set MD_BROKEN for RAID1 and RAID10") Signed-off-by: Kenta Akagi <[email protected]>
1 parent c321d71 commit 17a3273

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

drivers/md/md.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ static void super_written(struct bio *bio)
989989
md_error(mddev, rdev);
990990
if (!test_bit(Faulty, &rdev->flags)
991991
&& (bio->bi_opf & MD_FAILFAST)) {
992+
clear_bit(MD_BROKEN, &mddev->flags);
992993
set_bit(MD_SB_NEED_REWRITE, &mddev->sb_flags);
993994
set_bit(LastDev, &rdev->flags);
994995
}

drivers/md/md.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ struct md_cluster_operations;
332332
* resync lock, need to release the lock.
333333
* @MD_FAILFAST_SUPPORTED: Using MD_FAILFAST on metadata writes is supported as
334334
* calls to md_error() will never cause the array to
335-
* become failed.
335+
* become failed while fail_last_dev is not set.
336336
* @MD_HAS_PPL: The raid array has PPL feature set.
337337
* @MD_HAS_MULTIPLE_PPLS: The raid array has multiple PPLs feature set.
338338
* @MD_NOT_READY: do_md_run() is active, so 'array_state', ust not report that

0 commit comments

Comments
 (0)