- the attached patch (against -ac9) fixes a bug in the RAID1 and RAID4/5
  code that made raidhotremove fail under certain (rare) circumstances.
  Please apply.

        Ingo
--- linux/drivers/md/raid1.c.orig       Mon Dec 11 22:19:35 2000
+++ linux/drivers/md/raid1.c    Mon Jan 15 14:45:35 2001
@@ -832,6 +832,7 @@
        struct mirror_info *tmp, *sdisk, *fdisk, *rdisk, *adisk;
        mdp_super_t *sb = mddev->sb;
        mdp_disk_t *failed_desc, *spare_desc, *added_desc;
+       mdk_rdev_t *spare_rdev, *failed_rdev;
 
        print_raid1_conf(conf);
        md_spin_lock_irq(&conf->device_lock);
@@ -989,6 +990,10 @@
                /*
                 * do the switch finally
                 */
+               spare_rdev = find_rdev_nr(mddev, spare_desc->number);
+               failed_rdev = find_rdev_nr(mddev, failed_desc->number);
+               xchg_values(spare_rdev->desc_nr, failed_rdev->desc_nr);
+
                xchg_values(*spare_desc, *failed_desc);
                xchg_values(*fdisk, *sdisk);
 
--- linux/drivers/md/raid5.c.orig       Mon Jan 15 14:45:50 2001
+++ linux/drivers/md/raid5.c    Mon Jan 15 14:46:01 2001
@@ -1707,6 +1707,7 @@
        struct disk_info *tmp, *sdisk, *fdisk, *rdisk, *adisk;
        mdp_super_t *sb = mddev->sb;
        mdp_disk_t *failed_desc, *spare_desc, *added_desc;
+       mdk_rdev_t *spare_rdev, *failed_rdev;
 
        print_raid5_conf(conf);
        md_spin_lock_irq(&conf->device_lock);
@@ -1878,6 +1879,10 @@
                /*
                 * do the switch finally
                 */
+               spare_rdev = find_rdev_nr(mddev, spare_desc->number);
+               failed_rdev = find_rdev_nr(mddev, failed_desc->number);
+               xchg_values(spare_rdev->desc_nr, failed_rdev->desc_nr);
+
                xchg_values(*spare_desc, *failed_desc);
                xchg_values(*fdisk, *sdisk);
 

Reply via email to