]> git.hungrycats.org Git - linux/commitdiff
[PATCH] md: Fix possible hang in raid shutdown.
authorAndrew Morton <akpm@osdl.org>
Fri, 23 Jan 2004 00:41:04 +0000 (16:41 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 23 Jan 2004 00:41:04 +0000 (16:41 -0800)
From: NeilBrown <neilb@cse.unsw.edu.au>

If a raid array was syncing on shutdown, it would hang on shutdown,
constantly re-entering md_enter_safemade.  This fixes it.

drivers/md/md.c

index 07f8b76d88004f571555192593837de7a093d8ce..75e8eec116ed1ebb57e19acbf30c69d310318c8f 100644 (file)
@@ -3106,7 +3106,8 @@ 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))
+           (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) &&