linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] autofs4 - expiring filesystem from under process
@ 2005-04-10 12:48 raven
  2005-04-11 17:05 ` Jeff Moyer
  0 siblings, 1 reply; 9+ messages in thread
From: raven @ 2005-04-10 12:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: autofs mailing list, Michael Blandford, linux-fsdevel, Jeff Moyer


autofs4-2.6.12-rc1-mm4-wait-order.patch

It's possible for an event wait request to arive before the event
requestor. If this happens the daemon never gets notified and autofs
hangs.

Signed-off-by: Ian Kent <raven@themaw.net>

--- linux-2.6.12-rc1-mm4/fs/autofs4/waitq.c.wait-order	2005-04-03 12:30:14.000000000 +0800
+++ linux-2.6.12-rc1-mm4/fs/autofs4/waitq.c	2005-04-03 12:31:57.000000000 +0800
@@ -210,17 +210,8 @@ int autofs4_wait(struct autofs_sb_info *
  		wq->len = len;
  		wq->status = -EINTR; /* Status return if interrupted */
  		atomic_set(&wq->wait_ctr, 2);
+		atomic_set(&wq->notified, 1);
  		up(&sbi->wq_sem);
-
-		DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d",
-			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
-		/* autofs4_notify_daemon() may block */
-		if (notify != NFY_NONE) {
-			autofs4_notify_daemon(sbi,wq, 
-					notify == NFY_MOUNT ?
-						  autofs_ptype_missing :
-						  autofs_ptype_expire_multi);
-		}
  	} else {
  		atomic_inc(&wq->wait_ctr);
  		up(&sbi->wq_sem);
@@ -229,6 +220,17 @@ int autofs4_wait(struct autofs_sb_info *
  			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
  	}

+	if (notify != NFY_NONE && atomic_dec_and_test(&wq->notified)) {
+		int type = (notify == NFY_MOUNT ? 
+			autofs_ptype_missing : autofs_ptype_expire_multi);
+
+		DPRINTK(("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
+			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify));
+
+		/* autofs4_notify_daemon() may block */
+		autofs4_notify_daemon(sbi, wq, type);
+	}
+
  	/* wq->name is NULL if and only if the lock is already released */

  	if ( sbi->catatonic ) {
--- linux-2.6.12-rc1-mm4/fs/autofs4/autofs_i.h.wait-order	2005-04-03 12:30:24.000000000 +0800
+++ linux-2.6.12-rc1-mm4/fs/autofs4/autofs_i.h	2005-04-03 12:30:46.000000000 +0800
@@ -84,6 +84,7 @@ struct autofs_wait_queue {
  	char *name;
  	/* This is for status reporting upon return */
  	int status;
+	atomic_t notified;
  	atomic_t wait_ctr;
  };


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-23 12:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-10 12:48 [PATCH 1/3] autofs4 - expiring filesystem from under process raven
2005-04-11 17:05 ` Jeff Moyer
2005-04-12 12:44   ` raven
2005-04-20 14:34   ` raven
2005-04-20 21:03     ` Jeff Moyer
2005-04-21  9:34       ` Ian Kent
2005-04-22 18:28         ` Jeff Moyer
2005-04-23  3:26           ` raven
2005-05-23 12:38       ` raven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).