diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-06-03 09:23:20 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-06-03 09:23:20 +0000 |
commit | ac5ff8f4a72f7b4e66f73c3c6cb9fe7758cf6f12 (patch) | |
tree | 9fc7f8ce32e0d9a4aa055b2a58a05a5d727b333c /fs/autofs/waitq.c | |
parent | 52662ff3e66770fd7e4fc508c91056d29c08bff0 (diff) |
Sync with Linux 2.1.42.
Diffstat (limited to 'fs/autofs/waitq.c')
-rw-r--r-- | fs/autofs/waitq.c | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c index 719e04eb4..cbe270a53 100644 --- a/fs/autofs/waitq.c +++ b/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 @@ int autofs_wait(struct autofs_sb_info *sbi, autofs_hash_t hash, const char *name 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 @@ int autofs_wait(struct autofs_sb_info *sbi, autofs_hash_t hash, const char *name 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 @@ int autofs_wait_release(struct autofs_sb_info *sbi, unsigned long wait_queue_tok { 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 @@ int autofs_wait_release(struct autofs_sb_info *sbi, unsigned long wait_queue_tok 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; } |