android_kernel_xiaomi_sm8350/fs/autofs4
Ian Kent 1864f7bd58 autofs4: deadlock during create
Due to inconsistent locking in the VFS between calls to lookup and
revalidate deadlock can occur in the automounter.

The inconsistency is that the directory inode mutex is held for both lookup
and revalidate calls when called via lookup_hash whereas it is held only
for lookup during a path walk.  Consequently, if the mutex is held during a
call to revalidate autofs4 can't release the mutex to callback the daemon
as it can't know whether it owns the mutex.

This situation happens when a process tries to create a directory within an
automount and a second process also tries to create the same directory
between the lookup and the mkdir.  Since the first process has dropped the
mutex for the daemon callback, the second process takes it during
revalidate leading to deadlock between the autofs daemon and the second
process when the daemon tries to create the mount point directory.

After spending quite a bit of time trying to resolve this on more than one
occassion, using rather complex and ulgy approaches, it turns out that just
delaying the hashing of the dentry until the create operation works fine.

Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-22 19:52:46 -07:00
..
autofs_i.h [PATCH] autofs4: fix another race between mount and expire 2007-02-20 17:10:15 -08:00
expire.c
init.c [PATCH] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super() 2006-10-11 11:14:25 -07:00
inode.c Fix some coding-style errors in autofs 2007-05-11 08:29:36 -07:00
Makefile
root.c autofs4: deadlock during create 2007-08-22 19:52:46 -07:00
symlink.c [PATCH] mark struct inode_operations const 1 2007-02-12 09:48:46 -08:00
waitq.c [PATCH] autofs4: header file update 2007-02-20 17:10:15 -08:00