Re: NFS client questions...

H.J. Lu (hjl@lucon.org)
Sat, 31 Jul 1999 09:19:02 -0700 (PDT)


>
> Ok, I'll check it out next week. :)
>
> Question though. In the patch I sent you, I figure'd that it wasn't
> the cause but more of a "failsafe" just in case something like that
> happened. Would it be "prudent" (I just love that word :) ) to put
> that patch in as well to prevent kernel hangs (or, instead of just
> taking it off the list, print some sort of error so that if in the
> future it happens, at least it will be flagged?)
>

Here is the revised patch. Please discard my previous one.

Thanks.

-- 
H.J. Lu (hjl@gnu.org)
----
diff -upr -x *.o -x *.flags -x CVS -x .depend ../usr/src/linux-2.2.7/fs/lockd/clntlock.c fs/lockd/clntlock.c
--- ../usr/src/linux-2.2.7/fs/lockd/clntlock.c	Mon Jan  4 10:23:42 1999
+++ fs/lockd/clntlock.c	Fri Jul 30 14:04:54 1999
@@ -172,7 +172,7 @@ reclaimer(void *ptr)
 
 	/* First, reclaim all locks that have been granted previously. */
 	do {
-		for (fl = file_lock_table; fl; fl = fl->fl_next) {
+		for (fl = file_lock_table; fl; fl = fl->fl_nextlink) {
 			inode = fl->fl_file->f_dentry->d_inode;
 			if (inode->i_sb->s_magic == NFS_SUPER_MAGIC
 			 && nlm_cmp_addr(NFS_ADDR(inode), &host->h_addr)
diff -upr -x *.o -x *.flags -x CVS -x .depend ../usr/src/linux-2.2.7/fs/lockd/svclock.c fs/lockd/svclock.c
--- ../usr/src/linux-2.2.7/fs/lockd/svclock.c	Wed Feb 17 09:44:33 1999
+++ fs/lockd/svclock.c	Sat Jul 31 08:34:45 1999
@@ -335,9 +335,12 @@ again:
 	/* Append to list of blocked */
 	nlmsvc_insert_block(block, NLM_NEVER);
 
-	/* Now add block to block list of the conflicting lock */
-	dprintk("lockd: blocking on this lock.\n");
-	posix_block_lock(conflock, &block->b_call.a_args.lock.fl);
+	if (!block->b_call.a_args.lock.fl.fl_prevblock) {
+		/* Now add block to block list of the conflicting lock
+		   if we haven't done so. */
+		dprintk("lockd: blocking on this lock.\n");
+		posix_block_lock(conflock, &block->b_call.a_args.lock.fl);
+	}
 
 	up(&file->f_sema);
 	return nlm_lck_blocked;
@@ -440,7 +443,7 @@ nlmsvc_notify_blocked(struct file_lock *
 	dprintk("lockd: VFS unblock notification for block %p\n", fl);
 	posix_unblock_lock(fl);
 	for (bp = &nlm_blocked; (block = *bp); bp = &block->b_next) {
-		if (&block->b_call.a_args.lock.fl == fl) {
+		if (nlm_compare_locks(&block->b_call.a_args.lock.fl, fl)) {
 			svc_wake_up(block->b_daemon);
 			nlmsvc_insert_block(block, 0);
 			return;
Only in fs/lockd: svclock.c.orig
Only in fs/lockd: svclock.c.rej
diff -upr -x *.o -x *.flags -x CVS -x .depend ../usr/src/linux-2.2.7/fs/locks.c fs/locks.c
--- ../usr/src/linux-2.2.7/fs/locks.c	Wed Jul 21 12:24:21 1999
+++ fs/locks.c	Sat Jul 31 08:36:58 1999
@@ -193,6 +193,14 @@ static void locks_insert_block(struct fi
 {
 	struct file_lock *prevblock;
 
+	if (waiter->fl_prevblock) {
+		printk("locks_insert_block: remove duplicated lock "
+			"(pid=%d %ld-%ld type=%d)\n",
+			waiter->fl_pid, waiter->fl_start,
+			waiter->fl_end, waiter->fl_type);
+		locks_delete_block(waiter->fl_prevblock, waiter);
+	}
+
 	if (blocker->fl_prevblock == NULL)
 		/* No previous waiters - list is empty */
 		prevblock = blocker;

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/