linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guoqing Jiang <gqjiang@suse.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, Guoqing Jiang <gqjiang@suse.com>
Subject: [PATCH] util: fix wrong return value of cluster_get_dlmlock
Date: Wed, 20 Jan 2016 16:21:25 +0800	[thread overview]
Message-ID: <1453278085-19883-1-git-send-email-gqjiang@suse.com> (raw)

Actually lksb.sb_status means that a node get the lock
or not instead of the return value of dlm_lock.

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
 util.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/util.c b/util.c
index f1b0b95..cf9572b 100644
--- a/util.c
+++ b/util.c
@@ -142,7 +142,7 @@ int cluster_get_dlmlock(int *lockid)
 	dlm_lock_res->ls = dlm_hooks->create_lockspace(cluster_name, O_RDWR);
 	if (!dlm_lock_res->ls) {
 		pr_err("%s failed to create lockspace\n", cluster_name);
-                goto out;
+		return -ENOMEM;
 	}
 
 	/* Conversions need the lockid in the LKSB */
@@ -157,21 +157,15 @@ int cluster_get_dlmlock(int *lockid)
 			  dlm_lock_res, NULL, NULL);
 	if (ret) {
 		pr_err("error %d when get PW mode on lock %s\n", errno, str);
-                goto out;
+		dlm_hooks->release_lockspace(cluster_name, dlm_lock_res->ls, 1);
+		return ret;
 	}
 
 	/* Wait for it to complete */
 	poll_for_ast(dlm_lock_res->ls);
 	*lockid = dlm_lock_res->lksb.sb_lkid;
 
-	errno =	dlm_lock_res->lksb.sb_status;
-	if (errno) {
-		pr_err("error %d happened in ast with lock %s\n", errno, str);
-		goto out;
-	}
-
-out:
-	return ret;
+	return dlm_lock_res->lksb.sb_status;
 }
 
 int cluster_release_dlmlock(int lockid)
-- 
2.6.2


             reply	other threads:[~2016-01-20  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20  8:21 Guoqing Jiang [this message]
2016-01-27  0:44 ` [PATCH] util: fix wrong return value of cluster_get_dlmlock NeilBrown

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=1453278085-19883-1-git-send-email-gqjiang@suse.com \
    --to=gqjiang@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).