From d46286bdfb704cc56972863cb067244b8bb6df43 Mon Sep 17 00:00:00 2001 From: Ryan Haasken Date: Thu, 8 May 2014 09:18:36 -0500 Subject: [PATCH] LU-4985 kernel: Store kthread_run result in task_struct ptr 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 Change-Id: I18edab018080ec51e9979164234e5bcd02a04f88 Reviewed-on: http://review.whamcloud.com/10266 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Dmitry Eremin --- lustre/lfsck/lfsck_layout.c | 10 ++++++---- lustre/lfsck/lfsck_lib.c | 10 ++++++---- lustre/lfsck/lfsck_namespace.c | 12 +++++++----- lustre/ofd/ofd_io.c | 12 +++++++----- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index d63d5ee..ced2e4d 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -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 }; diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index aff81bc..db73616 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -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); diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 586694f..4dccb70 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -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); diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 96811b7..cdc5940 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -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; -- 1.8.3.1