Whamcloud - gitweb
LU-3469 osp: osp_sync() to flush pending changes synchronously
[fs/lustre-release.git] / lustre / lfsck / lfsck_lib.c
index 891becc..db73616 100644 (file)
@@ -2020,7 +2020,8 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
        struct lfsck_component          *com;
        struct l_wait_info               lwi    = { 0 };
        struct lfsck_thread_args        *lta;
-       long                             rc     = 0;
+       struct task_struct              *task;
+       int                              rc     = 0;
        __u16                            valid  = 0;
        __u16                            flags  = 0;
        __u16                            type   = 1;
@@ -2046,6 +2047,11 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
        spin_lock(&lfsck->li_lock);
        if (!thread_is_init(thread) && !thread_is_stopped(thread)) {
                rc = -EALREADY;
+               if (unlikely(start == NULL)) {
+                       spin_unlock(&lfsck->li_lock);
+                       GOTO(out, rc);
+               }
+
                while (start->ls_active != 0) {
                        if (!(type & start->ls_active)) {
                                type <<= 1;
@@ -2190,9 +2196,10 @@ trigger:
                GOTO(out, rc = PTR_ERR(lta));
 
        __lfsck_set_speed(lfsck, bk->lb_speed_limit);
-       rc = PTR_ERR(kthread_run(lfsck_master_engine, lta, "lfsck"));
-       if (IS_ERR_VALUE(rc)) {
-               CERROR("%s: cannot start LFSCK thread: rc = %ld\n",
+       task = kthread_run(lfsck_master_engine, lta, "lfsck");
+       if (IS_ERR(task)) {
+               rc = PTR_ERR(task);
+               CERROR("%s: cannot start LFSCK thread: rc = %d\n",
                       lfsck_lfsck2name(lfsck), rc);
                lfsck_thread_args_fini(lta);