Skip to contentSkip to conversation

cluster/dlm-kernel/src device.c

Cluster-devel [email protected] 1 participant 1 message Sep 12, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: pcaulfield at sourceware.org 2007-09-12 08:40:10

Modified files:
dlm-kernel/src : device.c

Log message:
When closing the device, try very hard to release all the locks. In particular if we get -EBUSY as a status, wwe must wait until the lock is longer busy.

Fix for PostFinance bug bz#280161

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/device.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.24.2.9&r2=1.24.2.10

dlm-kernel/src/Attic/device.c +12 -6
@@ -544,13 +544,19 @@
 
 			/* If it was waiting for a conversion, it will
 			   now be granted so we can unlock it properly */
-			if (lock_status == GDLM_LKSTS_CONVERT) {
-				flags &= ~DLM_LKF_CANCEL;
-				clear_bit(LI_FLAG_COMPLETE, &li.li_flags);
-				status = dlm_unlock(f->fi_ls->ls_lockspace, lkb->lkb_id, flags, &li.li_lksb, &li);
+			if (lock_status == GDLM_LKSTS_CONVERT || status == -EBUSY) {
+				do {
+					flags &= ~DLM_LKF_CANCEL;
+					clear_bit(LI_FLAG_COMPLETE, &li.li_flags);
+					status = dlm_unlock(f->fi_ls->ls_lockspace, lkb->lkb_id, flags, &li.li_lksb, &li);
 
-				if (status == 0)
-					wait_for_ast(&li);
+					if (status == 0)
+						wait_for_ast(&li);
+
+					if (status == -EBUSY)
+						msleep(1);
+
+				} while (status == -EBUSY);
 			}
 		}