WSL2-Linux-Kernel/fs/autofs4
Ian Kent 8f63aaa8b9 autofs4: fix lookup deadlock
A deadlock can occur when user space uses a signal (autofs version 4 uses
SIGCHLD for this) to effect expire completion.

The order of events is:

Expire process completes, but before being able to send SIGCHLD to it's parent
...

Another process walks onto a different mount point and drops the directory
inode semaphore prior to sending the request to the daemon as it must ...

A third process does an lstat on on the expired mount point causing it to wait
on expire completion (unfortunately) holding the directory semaphore.

The mount request then arrives at the daemon which does an lstat and,
deadlock.

For some time I was concerned about releasing the directory semaphore around
the expire wait in autofs4_lookup as well as for the mount call back.  I
finally realized that the last round of changes in this function made the
expiring dentry and the lookup dentry separate and distinct so the check and
possible wait can be done anywhere prior to the mount call back.  This patch
moves the check to just before the mount call back and inside the directory
inode mutex release.

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>
2009-04-01 08:59:23 -07:00
..
Kconfig fs/Kconfig: move autofs, autofs4 out 2009-01-22 13:15:54 +03:00
Makefile autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
autofs_i.h autofs4: cleanup expire code duplication 2009-04-01 08:59:23 -07:00
dev-ioctl.c autofs4: cleanup expire code duplication 2009-04-01 08:59:23 -07:00
expire.c autofs4: cleanup expire code duplication 2009-04-01 08:59:23 -07:00
init.c autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
inode.c constify dentry_operations: autofs, autofs4 2009-03-27 14:44:00 -04:00
root.c autofs4: fix lookup deadlock 2009-04-01 08:59:23 -07:00
symlink.c [PATCH] mark struct inode_operations const 1 2007-02-12 09:48:46 -08:00
waitq.c autofs4: make autofs type usage explicit 2009-01-06 15:59:23 -08:00