projects/linux·commit d0fae18f

md: clean up irregularity with raid autodetect

d0fae18f · NeilBrown <[email protected]> · 2008-03-04 14:29:31 -08:00

When a raid1 array is stopped, all components currently get added to the list
for auto-detection.  However we should really only add components that were
found by autodetection in the first place.  So add a flag to record that
information, and use it.

Signed-off-by: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
d0fae18f1b53a1d39135a968792be034bdf7ff26
Parents
a1801f85

Changes

2 files changed · +4 −1

FileStatusAddDelContent
drivers/md/md.cmodified+3−1View file
include/linux/raid/md_k.hmodified+1−0View file

drivers/md/md.c

View file
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b375de5..a71241c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1503,7 +1503,8 @@ static void export_rdev(mdk_rdev_t * rdev)
free_disk_sb(rdev);
list_del_init(&rdev->same_set);
#ifndef MODULE
- md_autodetect_dev(rdev->bdev->bd_dev);
+ if (test_bit(AutoDetected, &rdev->flags))
+ md_autodetect_dev(rdev->bdev->bd_dev);
#endif
unlock_rdev(rdev);
kobject_put(&rdev->kobj);
@@ -6025,6 +6026,7 @@ static void autostart_arrays(int part)
MD_BUG();
continue;
}
+ set_bit(AutoDetected, &rdev->flags);
list_add(&rdev->same_set, &pending_raid_disks);
i_passed++;
}

include/linux/raid/md_k.h

View file
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 85a068b..7bb6d1a 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -83,6 +83,7 @@ struct mdk_rdev_s
#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
#define AllReserved 6 /* If whole device is reserved for
* one array */
+#define AutoDetected 7 /* added by auto-detect */
int desc_nr; /* descriptor index in the superblock */
int raid_disk; /* role of device in array */