From owner-freebsd-bugs Tue Jan 15 13:55:15 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by hub.freebsd.org (Postfix) with ESMTP id 9DD5137B400 for ; Tue, 15 Jan 2002 13:55:11 -0800 (PST) Received: from blackbox.pacbell.net ([64.166.86.21]) by mta5.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GQ000A6G27YU0@mta5.snfc21.pbi.net> for freebsd-bugs@freebsd.org; Tue, 15 Jan 2002 13:55:11 -0800 (PST) Received: (from mikem@localhost) by blackbox.pacbell.net (8.11.6/8.11.6) id g0FLtKC84459; Tue, 15 Jan 2002 13:55:20 -0800 (PST envelope-from mikem) Date: Tue, 15 Jan 2002 13:55:20 -0800 From: Mike Makonnen Subject: Re: bin/33897: rpc.lockd problems on server In-reply-to: <200201150910.g0F9A2H04083@freefall.freebsd.org> To: Thomas Quinot Cc: freebsd-bugs@freebsd.org Message-id: <200201152155.g0FLtKC84459@blackbox.pacbell.net> MIME-version: 1.0 X-Mailer: Sylpheed version 0.7.0 (GTK+ 1.2.10; i386--freebsd5.0) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT References: <200201150910.g0F9A2H04083@freefall.freebsd.org> Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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