From: Chrissie Caulfield <ccaulfie@redhat.com>
To: linux-lvm@redhat.com
Subject: Re: [linux-lvm] clvmd-corosync should check lksb.sb_status instead of return code ?
Date: Wed, 25 Feb 2009 13:30:19 +0000 [thread overview]
Message-ID: <49A547EB.6020106@redhat.com> (raw)
In-Reply-To: <1cafab770902250235x39c180a4x63b9e5e6d9a761d5@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
Xinwei Hu wrote:
> Hi all,
>
> In clvmd-corosync, lock_resource calls dlm_ls_lock_wait with flags
> set to LKF_NOQUEUE.
> When LKF_NOQUEUE is set, the return code of dlm_ls_lock_wait is
> always 0, while the actual errno is in lksb.sb_status.
>
> This causes problem when using vgchange -aey or something like.
>
> I attached a patch to try to fix this issue.
>
> Please help to review. Thanks.
Hi
You are correct, the functions do need to check the LKSB. Your patch
isn't quite right I don't think though - the lksb status should be
returned in errno as shown below:
--
Chrissie
[-- Attachment #2: clvmd-corosync2.diff --]
[-- Type: text/x-patch, Size: 968 bytes --]
Index: clvmd-corosync.c
===================================================================
RCS file: /cvs/lvm2/LVM2/daemons/clvmd/clvmd-corosync.c,v
retrieving revision 1.5
diff -u -p -r1.5 clvmd-corosync.c
--- clvmd-corosync.c 11 Feb 2009 10:13:20 -0000 1.5
+++ clvmd-corosync.c 25 Feb 2009 13:28:34 -0000
@@ -478,6 +478,12 @@ static int _lock_resource(const char *re
DEBUGLOG("dlm_ls_lock returned %d\n", errno);
return err;
}
+ if (lksb.sb_status != 0)
+ {
+ DEBUGLOG("dlm_ls_lock returns lksb.sb_status %d\n", lksb.sb_status);
+ errno = -lksb.sb_status;
+ return -1;
+ }
DEBUGLOG("lock_resource returning %d, lock_id=%x\n", err, lksb.sb_lkid);
@@ -504,6 +510,13 @@ static int _unlock_resource(const char *
DEBUGLOG("Unlock returned %d\n", err);
return err;
}
+ if (lksb.sb_status != 0)
+ {
+ DEBUGLOG("dlm_ls_unlock_wait returns lksb.sb_status: %d\n", lksb.sb_status);
+ errno = -lksb.sb_status;
+ return -1;
+ }
+
return 0;
}
next prev parent reply other threads:[~2009-02-25 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 10:35 [linux-lvm] clvmd-corosync should check lksb.sb_status instead of return code ? Xinwei Hu
2009-02-25 13:30 ` Chrissie Caulfield [this message]
2009-02-25 13:34 ` Xinwei Hu
2009-02-25 13:52 ` Chrissie Caulfield
2009-02-25 14:07 ` Xinwei Hu
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=49A547EB.6020106@redhat.com \
--to=ccaulfie@redhat.com \
--cc=linux-lvm@redhat.com \
/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 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.