patch-2.1.42 linux/fs/autofs/waitq.c

Next file: linux/fs/buffer.c
Previous file: linux/fs/autofs/autofs_i.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.41/linux/fs/autofs/waitq.c linux/fs/autofs/waitq.c
@@ -16,46 +16,6 @@
 #include <linux/file.h>
 #include "autofs_i.h"
 
-#ifdef DEBUG_WAITLIST
-#ifndef i386
-#error Only i386 implemented
-#endif
-
-static inline int sane_pointer(void *p)
-{
-	return (p == NULL) || ((unsigned) p > 0xc0000000);
-}
-
-void autofs_check_waitlist_integrity(struct autofs_sb_info *sbi, char *op)
-{
-	struct autofs_wait_queue **wqp, *wq;
-
-	if ( sbi->magic != AUTOFS_SBI_MAGIC ) {
-		printk("autofs: CHECK_WAITLIST with bogus sbi pointer: %p\n",
-		       sbi);
-		return;
-	}
-
-	wqp = &(sbi->queues);
-	while ( (wq = *wqp) ) {
-		if ( !sane_pointer(wq) ) {
-			printk("autofs(%s): wait queue pointer corrupt: ", op);
-			wqp = &(sbi->queues);
-			do {
-				wq = *wqp;
-				printk(" %p", wq);
-				wqp = &(wq->next);
-			} while ( sane_pointer(*wqp) );
-			printk("\n");
-			*wqp = NULL;
-			break;
-		} else {
-			wqp = &(wq->next);
-		}
-	}
-}
-#endif
-
 /* We make this a static variable rather than a part of the superblock; it
    is better if we don't reassign numbers easily even across filesystems */
 static int autofs_next_wait_queue = 1;
@@ -135,8 +95,6 @@
 	struct autofs_wait_queue *wq;
 	int status;
 
-	CHECK_WAITLIST(sbi,"wait");
-
 	for ( wq = sbi->queues ; wq ; wq = wq->next ) {
 		if ( wq->hash == hash &&
 		     wq->len == len &&
@@ -165,7 +123,7 @@
 		sbi->queues = wq;
 
 		/* autofs_notify_daemon() may block */
-		wq->wait_ctr = 1;
+		wq->wait_ctr = 2;
 		autofs_notify_daemon(sbi,wq);
 	} else
 		wq->wait_ctr++;
@@ -190,8 +148,6 @@
 {
 	struct autofs_wait_queue *wq, **wql;
 
-	CHECK_WAITLIST(sbi,"release");
-
 	for ( wql = &sbi->queues ; (wq = *wql) ; wql = &wq->next ) {
 		if ( wq->wait_queue_token == wait_queue_token )
 			break;
@@ -205,7 +161,10 @@
 
 	wq->status = status;
 
-	wake_up(&wq->queue);
+	if ( ! --wq->wait_ctr )	/* Is anyone still waiting for this guy? */
+		kfree(wq);
+	else
+		wake_up(&wq->queue);
 
 	return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov