public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Dmitry Eremin <dmitry.eremin@intel.com>,
	Ned Bass <bass6@llnl.gov>, Peng Tao <bergwolf@gmail.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: [PATCH v3 15/15] staging/lustre/ptlrpc: better error handling in ptlrpcd_start
Date: Tue,  3 Dec 2013 21:58:53 +0800	[thread overview]
Message-ID: <1386079133-6459-16-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1386079133-6459-1-git-send-email-bergwolf@gmail.com>

From: Dmitry Eremin <dmitry.eremin@intel.com>

This is only part of the original Lustre tree commit. It cleans up
ptlrpcd_start error handling a bit.

Lustre-change: http://review.whamcloud.com/6139
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3204
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c |   44 ++++++++++++------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
index 2ebdb1b..8a95fa5 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
@@ -600,7 +600,6 @@ static int ptlrpcd_bind(int index, int max)
 int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc)
 {
 	int rc;
-	int env = 0;
 
 	/*
 	 * Do not allow start second thread for one pc.
@@ -619,6 +618,7 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc)
 	pc->pc_set = ptlrpc_prep_set();
 	if (pc->pc_set == NULL)
 		GOTO(out, rc = -ENOMEM);
+
 	/*
 	 * So far only "client" ptlrpcd uses an environment. In the future,
 	 * ptlrpcd thread (or a thread-set) has to be given an argument,
@@ -626,40 +626,40 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc)
 	 */
 	rc = lu_context_init(&pc->pc_env.le_ctx, LCT_CL_THREAD|LCT_REMEMBER);
 	if (rc != 0)
-		GOTO(out, rc);
+		GOTO(out_set, rc);
 
-	env = 1;
 	{
 		struct task_struct *task;
-
 		if (index >= 0) {
 			rc = ptlrpcd_bind(index, max);
 			if (rc < 0)
-				GOTO(out, rc);
+				GOTO(out_env, rc);
 		}
 
-		task = kthread_run(ptlrpcd, pc, "%s", pc->pc_name);
+		task = kthread_run(ptlrpcd, pc, pc->pc_name);
 		if (IS_ERR(task))
-			GOTO(out, rc = PTR_ERR(task));
+			GOTO(out_env, rc = PTR_ERR(task));
 
-		rc = 0;
 		wait_for_completion(&pc->pc_starting);
 	}
-out:
-	if (rc) {
-		if (pc->pc_set != NULL) {
-			struct ptlrpc_request_set *set = pc->pc_set;
-
-			spin_lock(&pc->pc_lock);
-			pc->pc_set = NULL;
-			spin_unlock(&pc->pc_lock);
-			ptlrpc_set_destroy(set);
-		}
-		if (env != 0)
-			lu_context_fini(&pc->pc_env.le_ctx);
-		clear_bit(LIOD_BIND, &pc->pc_flags);
-		clear_bit(LIOD_START, &pc->pc_flags);
+	return 0;
+
+out_env:
+	lu_context_fini(&pc->pc_env.le_ctx);
+
+out_set:
+	if (pc->pc_set != NULL) {
+		struct ptlrpc_request_set *set = pc->pc_set;
+
+		spin_lock(&pc->pc_lock);
+		pc->pc_set = NULL;
+		spin_unlock(&pc->pc_lock);
+		ptlrpc_set_destroy(set);
 	}
+	clear_bit(LIOD_BIND, &pc->pc_flags);
+
+out:
+	clear_bit(LIOD_START, &pc->pc_flags);
 	return rc;
 }
 
-- 
1.7.9.5


      parent reply	other threads:[~2013-12-03 14:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 13:58 [PATCH v3 00/15] staging/lustre: sync with external tree, set 2 Peng Tao
2013-12-03 13:58 ` [PATCH v3 01/15] Revert "staging/lustre/nfs: writing to new files will return ENOENT" Peng Tao
2013-12-03 13:58 ` [PATCH v3 02/15] staging/lustre/llog: MGC to use OSD API for backup logs Peng Tao
2013-12-03 13:58 ` [PATCH v3 03/15] staging/lustre: constify uuid argument of obd_uuid2str Peng Tao
2013-12-03 13:58 ` [PATCH v3 04/15] staging/lustre: make obd_uuid_equals return bool Peng Tao
2013-12-03 13:58 ` [PATCH v3 05/15] staging/lustre/scrub: OI scrub on OST Peng Tao
2013-12-03 13:58 ` [PATCH v3 06/15] staging/lustre: make code align in lma_incompat Peng Tao
2013-12-03 13:58 ` [PATCH v3 07/15] staging/lustre/llite: don't check for O_CREAT in it_create_mode Peng Tao
2013-12-03 13:58 ` [PATCH v3 08/15] staging/lustre/build: fix compilation issue with is_compat_task Peng Tao
2013-12-03 13:58 ` [PATCH v3 09/15] staging/lustre/ptlrpc: Fix a crash when dereferencing NULL pointer Peng Tao
2013-12-03 13:58 ` [PATCH v3 10/15] staging/lustre/hsm: Add hsm_release feature Peng Tao
2013-12-03 13:58 ` [PATCH v3 11/15] staging/lustre/llite: extended attribute cache Peng Tao
2013-12-03 13:58 ` [PATCH v3 12/15] staging/lustre: clean up SET_BUT_UNUSED/UNUSED macros Peng Tao
2013-12-03 13:58 ` [PATCH v3 13/15] staging/lustre/pinger: remove never implemented suspend timeouts functionality Peng Tao
2013-12-03 13:58 ` [PATCH v3 14/15] staging/lustre/obdclass: remove unuse variables from lprocfs_stats_collect/clear Peng Tao
2013-12-03 13:58 ` Peng Tao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386079133-6459-16-git-send-email-bergwolf@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=andreas.dilger@intel.com \
    --cc=bass6@llnl.gov \
    --cc=dmitry.eremin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox