[kernel] r14411 - in dists/lenny/linux-2.6/debian: . patches/bugfix/all patches/series

Dann Frazier dannf at alioth.debian.org
Mon Oct 19 18:55:42 UTC 2009


Author: dannf
Date: Mon Oct 19 18:55:40 2009
New Revision: 14411

Log:
ocfs/dlm: fix race in dlm_get_lock_resource() which can cause
flock() to return EINVAL (Closes: #515741)

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/ocfs2-dlm-fix-race-during-lockres-mastery.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/20

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Mon Oct 19 01:25:16 2009	(r14410)
+++ dists/lenny/linux-2.6/debian/changelog	Mon Oct 19 18:55:40 2009	(r14411)
@@ -30,6 +30,8 @@
   [ dann frazier ]
   * autofs4: don't make expiring dentry negative, avoiding an oops
     (Closes: #530636)
+  * ocfs/dlm: fix race in dlm_get_lock_resource() which can cause
+    flock() to return EINVAL (Closes: #515741)
 
   [ Martin Michlmayr ]
   * Disable SYS_HAS_EARLY_PRINTK on SGI IP22 to work around a hang

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/ocfs2-dlm-fix-race-during-lockres-mastery.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/ocfs2-dlm-fix-race-during-lockres-mastery.patch	Mon Oct 19 18:55:40 2009	(r14411)
@@ -0,0 +1,53 @@
+commit 7b791d68562e4ce5ab57cbacb10a1ad4ee33956e
+Author: Sunil Mushran <sunil.mushran at oracle.com>
+Date:   Tue Dec 16 15:49:23 2008 -0800
+
+    ocfs2/dlm: Fix race during lockres mastery
+    
+    dlm_get_lock_resource() is supposed to return a lock resource with a proper
+    master. If multiple concurrent threads attempt to lookup the lockres for the
+    same lockid while the lock mastery in underway, one or more threads are likely
+    to return a lockres without a proper master.
+    
+    This patch makes the threads wait in dlm_get_lock_resource() while the mastery
+    is underway, ensuring all threads return the lockres with a proper master.
+    
+    This issue is known to be limited to users using the flock() syscall. For all
+    other fs operations, the ocfs2 dlmglue layer serializes the dlm op for each
+    lockid.
+    
+    Users encountering this bug will see flock() return EINVAL and dmesg have the
+    following error:
+    ERROR: Dlm error "DLM_BADARGS" while calling dlmlock on resource <LOCKID>: bad api args
+    
+    Reported-by: Coly Li <coyli at suse.de>
+    Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
+    Signed-off-by: Mark Fasheh <mfasheh at suse.com>
+
+diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
+index cbf3abe..54e182a 100644
+--- a/fs/ocfs2/dlm/dlmmaster.c
++++ b/fs/ocfs2/dlm/dlmmaster.c
+@@ -732,14 +732,21 @@ lookup:
+ 	if (tmpres) {
+ 		int dropping_ref = 0;
+ 
++		spin_unlock(&dlm->spinlock);
++
+ 		spin_lock(&tmpres->spinlock);
++		/* We wait for the other thread that is mastering the resource */
++		if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
++			__dlm_wait_on_lockres(tmpres);
++			BUG_ON(tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN);
++		}
++
+ 		if (tmpres->owner == dlm->node_num) {
+ 			BUG_ON(tmpres->state & DLM_LOCK_RES_DROPPING_REF);
+ 			dlm_lockres_grab_inflight_ref(dlm, tmpres);
+ 		} else if (tmpres->state & DLM_LOCK_RES_DROPPING_REF)
+ 			dropping_ref = 1;
+ 		spin_unlock(&tmpres->spinlock);
+-		spin_unlock(&dlm->spinlock);
+ 
+ 		/* wait until done messaging the master, drop our ref to allow
+ 		 * the lockres to be purged, start over. */

Modified: dists/lenny/linux-2.6/debian/patches/series/20
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/20	Mon Oct 19 01:25:16 2009	(r14410)
+++ dists/lenny/linux-2.6/debian/patches/series/20	Mon Oct 19 18:55:40 2009	(r14411)
@@ -19,3 +19,4 @@
 + bugfix/all/nbd-fix-io-hang-on-disconnected-nbds.patch
 + bugfix/all/acenic-pass-up-error-code-from-ace_load_firmware.patch
 + bugfix/all/axnet_cs-claim-netgear-fa411.patch
++ bugfix/all/ocfs2-dlm-fix-race-during-lockres-mastery.patch



More information about the Kernel-svn-changes mailing list