lkml.org 
[lkml]   [1999]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectautofs deadlock
Hi:

I've seen autofs lockup frequently when the nfs server goes down. This patch
seems to fix the problem to me.

The problem is that autofs_revalidate will not return until the userspace
automount has finished its job. But if autofs_revalidate was called with
the semaphore on the parent downed, the userspace automount cannot finish
its job since it needs to call mkdir which will wait on that same semaphore.
--
Debian GNU/Linux 2.1 is out! ( http://www.debian.org/ )
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Index: root.c
===================================================================
RCS file: /home/gondor/herbert/src/CVS/debian/kernel-source/fs/autofs/root.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -r1.1.1.4 -r1.2
--- root.c 1999/05/14 06:25:58 1.1.1.4
+++ root.c 1999/08/07 09:23:39 1.2
@@ -165,7 +165,7 @@
* yet completely filled in, and revalidate has to delay such
* lookups..
*/
-static int autofs_revalidate(struct dentry * dentry, int flags)
+static int autofs_do_revalidate(struct dentry * dentry, int flags)
{
struct inode * dir = dentry->d_parent->d_inode;
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
@@ -200,6 +200,13 @@
return 1;
}

+static int autofs_revalidate(struct dentry * dentry, int flags)
+{
+ up(&dentry->d_parent->d_inode->i_sem);
+ autofs_do_revalidate(dentry, flags);
+ down(&dentry->d_parent->d_inode->i_sem);
+}
+
static struct dentry_operations autofs_dentry_operations = {
autofs_revalidate, /* d_revalidate */
NULL, /* d_hash */
@@ -237,9 +244,7 @@
dentry->d_flags |= DCACHE_AUTOFS_PENDING;
d_add(dentry, NULL);

- up(&dir->i_sem);
autofs_revalidate(dentry, 0);
- down(&dir->i_sem);

/*
* If we are still pending, check if we had to handle
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.069 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site