Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2002 13:55:20 -0800
From:      Mike Makonnen <mike_makonnen@yahoo.com>
To:        Thomas Quinot <thomas@cuivre.fr.eu.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/33897: rpc.lockd problems on server
Message-ID:  <200201152155.g0FLtKC84459@blackbox.pacbell.net>
In-Reply-To: <200201150910.g0F9A2H04083@freefall.freebsd.org>
References:  <200201150910.g0F9A2H04083@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
alfred, I took a look at retry_blockingfilelocklist() and the solution seemed simple enough. Please correct me if I am wrong. It seems said routine doesn't take into account boundary conditions when putting back file_lock entries into the blocked lock-list. Specifically, it fails when the file_lock being put back is the last element in the list, and when it is the only element in the list. I've included a patch below. 

Basically, it introduces another variable: pfl, which keeps track of the list item before ifl. That way if nfl is NULL, ifl gets inserted after pfl. If pfl is also NULL, then it gets inserted at the head of the list (since it was the only element in the list).

Thomas, could you give it a try and see if it solves your problems?


cheers,
mike makonnen

Index: rpc.lockd/lockd_lock.c
===================================================================
RCS file: /FreeBSD/ncvs/src/usr.sbin/rpc.lockd/lockd_lock.c,v
retrieving revision 1.6
diff -u -r1.6 lockd_lock.c
--- rpc.lockd/lockd_lock.c	2 Dec 2001 11:10:46 -0000	1.6
+++ rpc.lockd/lockd_lock.c	15 Jan 2002 21:37:16 -0000
@@ -1226,11 +1226,12 @@
 retry_blockingfilelocklist(void)
 {
 	/* Retry all locks in the blocked list */
-	struct file_lock *ifl, *nfl; /* Iterator */
+	struct file_lock *ifl, *nfl, *pfl; /* Iterator */
 	enum partialfilelock_status pflstatus;
 
 	debuglog("Entering retry_blockingfilelocklist\n");
 
+	pfl = NULL;
 	ifl = LIST_FIRST(&blockedlocklist_head);
 	debuglog("Iterator choice %p\n",ifl);
 
@@ -1241,6 +1242,7 @@
 		 */
 		nfl = LIST_NEXT(ifl, nfslocklist);
 		debuglog("Iterator choice %p\n",ifl);
+		debuglog("Prev iterator choice %p\n",pfl);
 		debuglog("Next iterator choice %p\n",nfl);
 
 		/*
@@ -1260,11 +1262,24 @@
 		} else {
 			/* Reinsert lock back into same place in blocked list */
 			debuglog("Replacing blocked lock\n");
-			LIST_INSERT_BEFORE(nfl, ifl, nfslocklist);
+			if (nfl == NULL)
+				/* ifl is the last elem. in the list */
+				if (pfl == NULL)
+					/* ifl is the only elem. in the list */
+					LIST_INSERT_HEAD(&blockedlocklist_head, ifl, nfslocklist);
+				else
+					LIST_INSERT_AFTER(pfl, ifl, nfslocklist);
+			else
+				LIST_INSERT_BEFORE(nfl, ifl, nfslocklist);
 		}
 
 		/* Valid increment behavior regardless of state of ifl */
 		ifl = nfl;
+		/* if a lock was granted incrementing pfl would make it nfl */
+		if (pfl != NULL && (LIST_NEXT(pfl, nfslocklist) != nfl))
+			pfl = LIST_NEXT(pfl, nfslocklist);
+		else
+			pfl = LIST_FIRST(&blockedlocklist_head);
 	}
 
 	debuglog("Exiting retry_blockingfilelocklist\n");

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201152155.g0FLtKC84459>