]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
md: delay notification of 'active_idle' to the recovery thread
authorDan Williams <dan.j.williams@intel.com>
Wed, 23 Jul 2008 20:09:48 +0000 (13:09 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 23 Jul 2008 20:09:48 +0000 (13:09 -0700)
sysfs_notify might sleep, so do not call it from md_safemode_timeout.

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

index c2ff77ccec5079ded33ef9e440744fcd2eaff004..0f1b83096425a5afcb3642b7a3402ed4e4317e71 100644 (file)
@@ -3483,7 +3483,7 @@ static void md_safemode_timeout(unsigned long data)
        if (!atomic_read(&mddev->writes_pending)) {
                mddev->safemode = 1;
                if (mddev->external)
-                       sysfs_notify(&mddev->kobj, NULL, "array_state");
+                       set_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags);
        }
        md_wakeup_thread(mddev->thread);
 }
@@ -6051,6 +6051,9 @@ void md_check_recovery(mddev_t *mddev)
        if (mddev->bitmap)
                bitmap_daemon_work(mddev->bitmap);
 
+       if (test_and_clear_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags))
+               sysfs_notify(&mddev->kobj, NULL, "array_state");
+
        if (mddev->ro)
                return;
 
index 9f2549ac0e2d0133e014739cc7c5843fcb0a4e91..c200b9a34affc193500897aead3eec14f98f5f5f 100644 (file)
@@ -128,6 +128,7 @@ struct mddev_s
 #define MD_CHANGE_DEVS 0       /* Some device status has changed */
 #define MD_CHANGE_CLEAN 1      /* transition to or from 'clean' */
 #define MD_CHANGE_PENDING 2    /* superblock update in progress */
+#define MD_NOTIFY_ARRAY_STATE 3        /* atomic context wants to notify userspace */
 
        int                             ro;