Re: [autofs] [PATCH] autofs4: deadlock during create

From: Jeff Moyer
Date: Tue Aug 14 2007 - 10:18:25 EST


Ian Kent <raven@xxxxxxxxxx> writes:

> Hi,
>
> 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
> work fine.
>
> Signed-off-by: Ian Kent <raven@xxxxxxxxxx>

Acked-by: Jeff Moyer <jmoyer@xxxxxxxxxx>

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