Whamcloud - gitweb
LU-3498 kernel: remove uses of IS_ERR_VALUE()
[fs/lustre-release.git] / lustre / ptlrpc / service.c
index b312f8b..d9476b4 100644 (file)
@@ -2742,25 +2742,31 @@ static int ptlrpc_start_hr_threads(void)
                int     rc = 0;
 
                for (j = 0; j < hrp->hrp_nthrs; j++) {
-                       struct  ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
-                       rc = PTR_ERR(kthread_run(ptlrpc_hr_main,
-                                                &hrp->hrp_thrs[j],
-                                                "ptlrpc_hr%02d_%03d",
-                                                hrp->hrp_cpt,
-                                                hrt->hrt_id));
-                       if (IS_ERR_VALUE(rc))
+                       struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
+                       struct task_struct *task;
+
+                       task = kthread_run(ptlrpc_hr_main,
+                                          &hrp->hrp_thrs[j],
+                                          "ptlrpc_hr%02d_%03d",
+                                          hrp->hrp_cpt,
+                                          hrt->hrt_id);
+                       if (IS_ERR(task)) {
+                               rc = PTR_ERR(task);
                                break;
+                       }
                }
+
                wait_event(ptlrpc_hr.hr_waitq,
-                              atomic_read(&hrp->hrp_nstarted) == j);
-               if (!IS_ERR_VALUE(rc))
-                       continue;
+                          atomic_read(&hrp->hrp_nstarted) == j);
 
-               CERROR("Reply handling thread %d:%d Failed on starting: "
-                      "rc = %d\n", i, j, rc);
-               ptlrpc_stop_hr_threads();
-               RETURN(rc);
+               if (rc < 0) {
+                       CERROR("cannot start reply handler thread %d:%d: "
+                              "rc = %d\n", i, j, rc);
+                       ptlrpc_stop_hr_threads();
+                       RETURN(rc);
+               }
        }
+
        RETURN(0);
 }
 
@@ -2869,6 +2875,7 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
        struct l_wait_info      lwi = { 0 };
        struct ptlrpc_thread    *thread;
        struct ptlrpc_service   *svc;
+       struct task_struct      *task;
        int                     rc;
        ENTRY;
 
@@ -2936,9 +2943,10 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
        }
 
        CDEBUG(D_RPCTRACE, "starting thread '%s'\n", thread->t_name);
-       rc = PTR_ERR(kthread_run(ptlrpc_main, thread, thread->t_name));
-       if (IS_ERR_VALUE(rc)) {
-               CERROR("cannot start thread '%s': rc %d\n",
+       task = kthread_run(ptlrpc_main, thread, "%s", thread->t_name);
+       if (IS_ERR(task)) {
+               rc = PTR_ERR(task);
+               CERROR("cannot start thread '%s': rc = %d\n",
                       thread->t_name, rc);
                spin_lock(&svcpt->scp_lock);
                --svcpt->scp_nthrs_starting;