[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] libdlm: Don't pass LKF_WAIT to the kernel



libdlm is passing LKF_WAIT to the kernel.  In the kernel, the unlock
path strictly audits flags, and errors on this unknown (to the kernel)
flag.  The correct answer is to keep the flag in userspace.

Signed-off-by: Joel Becker <joel becker oracle com>

--- a/dlm/lib/libdlm.c	2008-01-16 09:25:48.000000000 -0800
+++ b/dlm/lib/libdlm.c	2008-03-19 13:30:21.000000000 -0700
@@ -754,7 +754,7 @@ static int ls_lock_v5(dlm_lshandle_t ls,
 
 	req->cmd = DLM_USER_LOCK;
 	req->i.lock.mode = mode;
-	req->i.lock.flags = flags;
+	req->i.lock.flags = (flags & ~LKF_WAIT);
 	req->i.lock.lkid = lksb->sb_lkid;
 	req->i.lock.parent = parent;
 	req->i.lock.lksb = lksb;
@@ -822,7 +822,7 @@ static int ls_lock_v6(dlm_lshandle_t ls,
 
 	req->cmd = DLM_USER_LOCK;
 	req->i.lock.mode = mode;
-	req->i.lock.flags = flags;
+	req->i.lock.flags = (flags & ~LKF_WAIT);
 	req->i.lock.lkid = lksb->sb_lkid;
 	req->i.lock.parent = parent;
 	req->i.lock.lksb = lksb;
@@ -1014,7 +1014,7 @@ static int ls_unlock_v5(struct dlm_ls_in
 	set_version_v5(&req);
 	req.cmd = DLM_USER_UNLOCK;
 	req.i.lock.lkid = lkid;
-	req.i.lock.flags = flags;
+	req.i.lock.flags = (flags & ~LKF_WAIT);
 	req.i.lock.lksb  = lksb;
 	req.i.lock.castparam = astarg;
 	/* DLM_USER_UNLOCK will default to existing completion AST */
@@ -1035,7 +1035,7 @@ static int ls_unlock_v6(struct dlm_ls_in
 	set_version_v6(&req);
 	req.cmd = DLM_USER_UNLOCK;
 	req.i.lock.lkid = lkid;
-	req.i.lock.flags = flags;
+	req.i.lock.flags = (flags & ~LKF_WAIT);
 	req.i.lock.lksb  = lksb;
 	req.i.lock.namelen = 0;
 	req.i.lock.castparam = astarg;

-- 

Life's Little Instruction Book #24

	"Drink champagne for no reason at all."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel becker oracle com
Phone: (650) 506-8127


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]