Message ID | 20241011011630.2002803-4-yukuai1@huaweicloud.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | md: enhance faulty checking for blocked handling | expand |
Context | Check | Description |
---|---|---|
mdraidci/vmtest-md-6_12-PR | fail | PR summary |
mdraidci/vmtest-md-6_12-VM_Test-0 | fail | Logs for per-patch-testing |
mdraidci/vmtest-md-6_13-PR | success | PR summary |
mdraidci/vmtest-md-6_13-VM_Test-0 | success | Logs for per-patch-testing |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 37d1469bfc82..35c2e1e761aa 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9791,6 +9791,17 @@ int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, { struct mddev *mddev = rdev->mddev; int rv; + + /* + * Recording new badblocks for faulty rdev will force unnecessary + * super block updating. This is fragile for external management because + * userspace daemon may trying to remove this device and deadlock may + * occur. This will be probably solved in the mdadm, but it is safer to + * avoid it. + */ + if (test_bit(Faulty, &rdev->flags)) + return 1; + if (is_new) s += rdev->new_data_offset; else