Whamcloud - gitweb
LU-6155 osd-zfs: dbuf_hold_impl() called without the lock
[fs/lustre-release.git] / libcfs / libcfs / fail.c
index 58a698e..303ee55 100644 (file)
@@ -38,7 +38,7 @@
 unsigned long cfs_fail_loc = 0;
 unsigned int cfs_fail_val = 0;
 int cfs_fail_err;
-wait_queue_head_t cfs_race_waitq;
+DECLARE_WAIT_QUEUE_HEAD(cfs_race_waitq);
 int cfs_race_state;
 
 EXPORT_SYMBOL(cfs_fail_loc);
@@ -112,6 +112,7 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)
                        break;
                case CFS_FAIL_LOC_RESET:
                        cfs_fail_loc = value;
+                       atomic_set(&cfs_fail_count, 0);
                        break;
                default:
                        LASSERTF(0, "called with bad set %u\n", set);
@@ -127,11 +128,11 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
        int ret = 0;
 
        ret = __cfs_fail_check_set(id, value, set);
-       if (ret) {
+       if (ret && likely(ms > 0)) {
                CERROR("cfs_fail_timeout id %x sleeping for %dms\n",
                       id, ms);
-               schedule_timeout_and_set_state(TASK_UNINTERRUPTIBLE,
-                                                  cfs_time_seconds(ms) / 1000);
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(cfs_time_seconds(ms) / 1000);
                set_current_state(TASK_RUNNING);
                CERROR("cfs_fail_timeout id %x awake\n", id);
        }