]> err.no Git - linux-2.6/commitdiff
md: cancel check/repair requests when recovery is needed
authorDan Williams <dan.j.williams@intel.com>
Thu, 7 Aug 2008 17:02:47 +0000 (10:02 -0700)
committerDan Williams <dan.j.williams@intel.com>
Thu, 7 Aug 2008 17:02:47 +0000 (10:02 -0700)
If a 'repair' is requested when an array is in a position to 'recover' raid1
will perform the repair while md believes a recovery is happening.  Address
this at both ends, i.e. cancel check/repair requests upon detecting a
recover condition and do not call ->spare_active after completing a
check/repair.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/md/md.c

index 25b893ec562eac27f339548ba767664f77dc8e44..8cfadc5bd2ba54f858c8f28c8f17c5db40942891 100644 (file)
@@ -6138,7 +6138,8 @@ void md_check_recovery(mddev_t *mddev)
                        /* resync has finished, collect result */
                        md_unregister_thread(mddev->sync_thread);
                        mddev->sync_thread = NULL;
-                       if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
+                       if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
+                           !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
                                /* success...*/
                                /* activate any spares */
                                if (mddev->pers->spare_active(mddev))
@@ -6190,6 +6191,7 @@ void md_check_recovery(mddev_t *mddev)
                } else if ((spares = remove_and_add_spares(mddev))) {
                        clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
                        clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
+                       clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
                        set_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
                } else if (mddev->recovery_cp < MaxSector) {
                        set_bit(MD_RECOVERY_SYNC, &mddev->recovery);