[PATCH] autofs4 - post expire race fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At the tail end of an expire it's possible for a process to enter
autofs4_wait, with a waitq type of NFY_NONE but find that the expire
is finished. In this cause autofs4_wait will try to create a new wait but 
not notify the daemon leading to a hang. As the wait type is meant to 
delay mount requests from revalidate or lookup during an expire and the 
expire is done all we need to do is check if the dentry is a mountpoint. 
If it's not then we're done.


diff -Nur linux-2.6.12-rc2-mm3.orig/fs/autofs4/waitq.c linux-2.6.12-rc2-mm3/fs/autofs4/waitq.c
--- linux-2.6.12-rc2-mm3.orig/fs/autofs4/waitq.c	2005-05-01 17:04:49.000000000 +0800
+++ linux-2.6.12-rc2-mm3/fs/autofs4/waitq.c	2005-05-01 17:07:18.000000000 +0800
@@ -191,6 +191,13 @@
 	}
 
 	if ( !wq ) {
+		/* Can't wait for an expire if there's no mount */
+		if (notify == NFY_NONE && !d_mountpoint(dentry)) {
+			kfree(name);
+			up(&sbi->wq_sem);
+			return -ENOENT;
+		}
+
 		/* Create a new wait queue */
 		wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
 		if ( !wq ) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux