[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [linux-lvm] clvmd-corosync should check lksb.sb_status instead of return code ?
- 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
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
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;
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]