diff options
-rw-r--r-- | drivers/md/md.c | 58 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 1 | ||||
-rw-r--r-- | drivers/md/raid6main.c | 1 |
5 files changed, 24 insertions, 38 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 60835dfd058..c842e34d850 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3203,37 +3203,6 @@ void md_write_end(mddev_t *mddev) } } -static inline void md_enter_safemode(mddev_t *mddev) -{ - if (!mddev->safemode) return; - if (mddev->safemode == 2 && - (atomic_read(&mddev->writes_pending) || mddev->in_sync || - mddev->recovery_cp != MaxSector)) - return; /* avoid the lock */ - mddev_lock_uninterruptible(mddev); - if (mddev->safemode && !atomic_read(&mddev->writes_pending) && - !mddev->in_sync && mddev->recovery_cp == MaxSector) { - mddev->in_sync = 1; - md_update_sb(mddev); - } - mddev_unlock(mddev); - - if (mddev->safemode == 1) - mddev->safemode = 0; -} - -void md_handle_safemode(mddev_t *mddev) -{ - if (signal_pending(current)) { - printk(KERN_INFO "md: %s in immediate safe mode\n", - mdname(mddev)); - mddev->safemode = 2; - flush_signals(current); - } - md_enter_safemode(mddev); -} - - static DECLARE_WAIT_QUEUE_HEAD(resync_wait); #define SYNC_MARKS 10 @@ -3449,7 +3418,6 @@ static void md_do_sync(mddev_t *mddev) mddev->recovery_cp = MaxSector; } - md_enter_safemode(mddev); skip: mddev->curr_resync = 0; wake_up(&resync_wait); @@ -3490,14 +3458,37 @@ void md_check_recovery(mddev_t *mddev) if (mddev->ro) return; + + if (signal_pending(current)) { + if (mddev->pers->sync_request) { + printk(KERN_INFO "md: %s in immediate safe mode\n", + mdname(mddev)); + mddev->safemode = 2; + } + flush_signals(current); + } + if ( ! ( mddev->sb_dirty || test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || - test_bit(MD_RECOVERY_DONE, &mddev->recovery) + test_bit(MD_RECOVERY_DONE, &mddev->recovery) || + (mddev->safemode == 1) || + (mddev->safemode == 2 && ! atomic_read(&mddev->writes_pending) + && !mddev->in_sync && mddev->recovery_cp == MaxSector) )) return; + if (mddev_trylock(mddev)==0) { int spares =0; + + if (mddev->safemode && !atomic_read(&mddev->writes_pending) && + !mddev->in_sync && mddev->recovery_cp == MaxSector) { + mddev->in_sync = 1; + mddev->sb_dirty = 1; + } + if (mddev->safemode == 1) + mddev->safemode = 0; + if (mddev->sb_dirty) md_update_sb(mddev); if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && @@ -3741,7 +3732,6 @@ EXPORT_SYMBOL(md_error); EXPORT_SYMBOL(md_done_sync); EXPORT_SYMBOL(md_write_start); EXPORT_SYMBOL(md_write_end); -EXPORT_SYMBOL(md_handle_safemode); EXPORT_SYMBOL(md_register_thread); EXPORT_SYMBOL(md_unregister_thread); EXPORT_SYMBOL(md_wakeup_thread); diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4947f599b65..b34ad56362d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -931,7 +931,6 @@ static void raid1d(mddev_t *mddev) mdk_rdev_t *rdev; md_check_recovery(mddev); - md_handle_safemode(mddev); for (;;) { char b[BDEVNAME_SIZE]; diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3c37be6423d..9ae21504db8 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1216,7 +1216,6 @@ static void raid10d(mddev_t *mddev) mdk_rdev_t *rdev; md_check_recovery(mddev); - md_handle_safemode(mddev); for (;;) { char b[BDEVNAME_SIZE]; diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3cb11ac232f..63b1c59d36f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1546,7 +1546,6 @@ static void raid5d (mddev_t *mddev) PRINTK("+++ raid5d active\n"); md_check_recovery(mddev); - md_handle_safemode(mddev); handled = 0; spin_lock_irq(&conf->device_lock); diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 908edd78a79..9d0e0e42a3b 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c @@ -1705,7 +1705,6 @@ static void raid6d (mddev_t *mddev) PRINTK("+++ raid6d active\n"); md_check_recovery(mddev); - md_handle_safemode(mddev); handled = 0; spin_lock_irq(&conf->device_lock); |