]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Sleep uninteruptibly, waking up early may result in a crash
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Jan 2009 17:58:48 +0000 (09:58 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Jan 2009 17:58:48 +0000 (09:58 -0800)
module/splat/splat-kmem.c
module/splat/splat-rwlock.c

index a9792b1a5927bffd2bbae5dac83a53f3e0f2ff0b..31499dde326ed1d117b4e0054e74d594f5ea87e3 100644 (file)
@@ -309,31 +309,32 @@ splat_kmem_cache_size_test(struct file *file, void *arg,
                                  NULL, &kcp, NULL, flags);
        if (!cache) {
                splat_vprint(file, name,
-                          "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME);
+                            "Unable to create '%s'\n",
+                            SPLAT_KMEM_CACHE_NAME);
                return -ENOMEM;
        }
 
        kcd = kmem_cache_alloc(cache, KM_SLEEP);
        if (!kcd) {
                splat_vprint(file, name,
-                          "Unable to allocate from '%s'\n",
-                          SPLAT_KMEM_CACHE_NAME);
+                            "Unable to allocate from '%s'\n",
+                            SPLAT_KMEM_CACHE_NAME);
                rc = -EINVAL;
                goto out_free;
        }
 
        if (!kcd->kcd_flag) {
                splat_vprint(file, name,
-                          "Failed to run contructor for '%s'\n",
-                          SPLAT_KMEM_CACHE_NAME);
+                            "Failed to run contructor for '%s'\n",
+                            SPLAT_KMEM_CACHE_NAME);
                rc = -EINVAL;
                goto out_free;
        }
 
        if (kcd->kcd_magic != kcp.kcp_magic) {
                splat_vprint(file, name,
-                          "Failed to pass private data to constructor "
-                          "for '%s'\n", SPLAT_KMEM_CACHE_NAME);
+                            "Failed to pass private data to constructor "
+                            "for '%s'\n", SPLAT_KMEM_CACHE_NAME);
                rc = -EINVAL;
                goto out_free;
        }
@@ -346,14 +347,14 @@ splat_kmem_cache_size_test(struct file *file, void *arg,
        kmem_cache_destroy(cache);
        if (kcp.kcp_count) {
                splat_vprint(file, name,
-                          "Failed to run destructor on all slab objects "
-                          "for '%s'\n", SPLAT_KMEM_CACHE_NAME);
+                            "Failed to run destructor on all slab objects "
+                            "for '%s'\n", SPLAT_KMEM_CACHE_NAME);
                rc = -EINVAL;
        }
 
        splat_vprint(file, name,
-                  "Successfully ran ctors/dtors for %d elements in '%s'\n",
-                  max, SPLAT_KMEM_CACHE_NAME);
+                    "Successfully ran ctors/dtors for %d elements in '%s'\n",
+                    max, SPLAT_KMEM_CACHE_NAME);
 
        return rc;
 
index b1db12ea8d1e4cc281fef312e427d903bf7b134d..70c9dc3d06899eecd5330b643c7ffdd34d84d8a7 100644 (file)
@@ -84,7 +84,7 @@ typedef struct rw_thr {
 static inline void
 splat_rwlock_sleep(signed long delay)
 {
-       set_current_state(TASK_INTERRUPTIBLE);
+       set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(delay);
 }
 
@@ -431,7 +431,7 @@ splat_rwlock_test2(struct file *file, void *arg)
        while (splat_rwlock_lock_and_test(&rwv.rw_priv_lock,
               atomic_read(&rwv.rw_acquired) != 0 ||
               atomic_read(&rwv.rw_waiters) != 0)) {
-               splat_rwlock_sleep(1 * HZ);
+               splat_rwlock_sleep(HZ);
        }
 
        /* If any of the write threads ever acquired the lock