autofs deadlock

Herbert Xu (herbert@gondor.apana.org.au)
Mon, 9 Aug 1999 17:26:43 +1000


--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii

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

--WIyZ46R2i8wDzkSu Content-Type: text/x-pascal Content-Description: autofs patch Content-Disposition: attachment; filename=p

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

--WIyZ46R2i8wDzkSu--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/