Whamcloud - gitweb
LU-4985 kernel: Store kthread_run result in task_struct ptr 66/10266/3
authorRyan Haasken <haasken@cray.com>
Thu, 8 May 2014 14:18:36 +0000 (09:18 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 May 2014 05:31:42 +0000 (05:31 +0000)
The fix for LU-3498 changed most invocations of kthread_run to store
the result in a variable of task_struct pointer type and check whether
kthread_run returned an error using IS_ERR.  This change updates the
remaining calls to kthread_run to do this as well for consistency.

Signed-off-by: Ryan Haasken <haasken@cray.com>
Change-Id: I18edab018080ec51e9979164234e5bcd02a04f88
Reviewed-on: http://review.whamcloud.com/10266
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/lfsck/lfsck_layout.c
lustre/lfsck/lfsck_lib.c
lustre/lfsck/lfsck_namespace.c
lustre/ofd/ofd_io.c

index d63d5ee..ced2e4d 100644 (file)
@@ -4312,7 +4312,8 @@ static int lfsck_layout_master_prep(const struct lu_env *env,
        struct ptlrpc_thread            *mthread = &lfsck->li_thread;
        struct ptlrpc_thread            *athread = &llmd->llmd_thread;
        struct lfsck_thread_args        *lta;
-       long                             rc;
+       struct task_struct              *task;
+       int                              rc;
        ENTRY;
 
        rc = lfsck_layout_prep(env, com, lsp->lsp_start);
@@ -4331,10 +4332,11 @@ static int lfsck_layout_master_prep(const struct lu_env *env,
        if (IS_ERR(lta))
                RETURN(PTR_ERR(lta));
 
-       rc = PTR_ERR(kthread_run(lfsck_layout_assistant, lta, "lfsck_layout"));
-       if (IS_ERR_VALUE(rc)) {
+       task = kthread_run(lfsck_layout_assistant, lta, "lfsck_layout");
+       if (IS_ERR(task)) {
+               rc = PTR_ERR(task);
                CERROR("%s: Cannot start LFSCK layout assistant thread: "
-                      "rc = %ld\n", lfsck_lfsck2name(lfsck), rc);
+                      "rc = %d\n", lfsck_lfsck2name(lfsck), rc);
                lfsck_thread_args_fini(lta);
        } else {
                struct l_wait_info lwi = { 0 };
index aff81bc..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;
@@ -2195,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);
 
index 586694f..4dccb70 100644 (file)
@@ -1543,7 +1543,8 @@ static int lfsck_namespace_double_scan(const struct lu_env *env,
        struct lfsck_instance           *lfsck = com->lc_lfsck;
        struct lfsck_namespace          *ns    = com->lc_file_ram;
        struct lfsck_thread_args        *lta;
-       long                             rc;
+       struct task_struct              *task;
+       int                              rc;
        ENTRY;
 
        if (unlikely(ns->ln_status != LS_SCANNING_PHASE2))
@@ -1554,10 +1555,11 @@ static int lfsck_namespace_double_scan(const struct lu_env *env,
                RETURN(PTR_ERR(lta));
 
        atomic_inc(&lfsck->li_double_scan_count);
-       rc = PTR_ERR(kthread_run(lfsck_namespace_double_scan_main, lta,
-                                "lfsck_namespace"));
-       if (IS_ERR_VALUE(rc)) {
-               CERROR("%s: cannot start LFSCK namespace thread: rc = %ld\n",
+       task = kthread_run(lfsck_namespace_double_scan_main, lta,
+                          "lfsck_namespace");
+       if (IS_ERR(task)) {
+               rc = PTR_ERR(task);
+               CERROR("%s: cannot start LFSCK namespace thread: rc = %d\n",
                       lfsck_lfsck2name(lfsck), rc);
                atomic_dec(&lfsck->li_double_scan_count);
                lfsck_thread_args_fini(lta);
index 96811b7..cdc5940 100644 (file)
@@ -216,7 +216,8 @@ int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd)
 {
        struct ptlrpc_thread    *thread = &ofd->ofd_inconsistency_thread;
        struct l_wait_info       lwi    = { 0 };
-       long                     rc;
+       struct task_struct      *task;
+       int                      rc;
 
        spin_lock(&ofd->ofd_inconsistency_lock);
        if (unlikely(thread_is_running(thread))) {
@@ -227,10 +228,11 @@ int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd)
 
        thread_set_flags(thread, 0);
        spin_unlock(&ofd->ofd_inconsistency_lock);
-       rc = PTR_ERR(kthread_run(ofd_inconsistency_verification_main, ofd,
-                                "inconsistency_verification"));
-       if (IS_ERR_VALUE(rc)) {
-               CERROR("%s: cannot start self_repair thread: rc = %ld\n",
+       task = kthread_run(ofd_inconsistency_verification_main, ofd,
+                          "inconsistency_verification");
+       if (IS_ERR(task)) {
+               rc = PTR_ERR(task);
+               CERROR("%s: cannot start self_repair thread: rc = %d\n",
                       ofd_obd(ofd)->obd_name, rc);
        } else {
                rc = 0;