* [PATCH] util: fix wrong return value of cluster_get_dlmlock
@ 2016-01-20 8:21 Guoqing Jiang
2016-01-27 0:44 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: Guoqing Jiang @ 2016-01-20 8:21 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, Guoqing Jiang
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] util: fix wrong return value of cluster_get_dlmlock
2016-01-20 8:21 [PATCH] util: fix wrong return value of cluster_get_dlmlock Guoqing Jiang
@ 2016-01-27 0:44 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2016-01-27 0:44 UTC (permalink / raw)
Cc: linux-raid, Guoqing Jiang
[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]
On Wed, Jan 20 2016, Guoqing Jiang wrote:
> 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)
> --
Applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-27 0:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 8:21 [PATCH] util: fix wrong return value of cluster_get_dlmlock Guoqing Jiang
2016-01-27 0:44 ` NeilBrown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.