Skip to content

Commit

Permalink
[PATCH] autofs4: post expire race fix
Browse files Browse the repository at this point in the history
At the tail end of an expire it's possible for a process to enter
autofs4_wait, with a waitq type of NFY_NONE but find that the expire is
finished.  In this cause autofs4_wait will try to create a new wait but not
notify the daemon leading to a hang.  As the wait type is meant to delay mount
requests from revalidate or lookup during an expire and the expire is done all
we need to do is check if the dentry is a mountpoint.  If it's not then we're
done.

Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Ian Kent authored and Linus Torvalds committed Jun 22, 2005
1 parent 9b1e3af commit cc9acc8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
}

if ( !wq ) {
/* Can't wait for an expire if there's no mount */
if (notify == NFY_NONE && !d_mountpoint(dentry)) {
kfree(name);
up(&sbi->wq_sem);
return -ENOENT;
}

/* Create a new wait queue */
wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
if ( !wq ) {
Expand Down

0 comments on commit cc9acc8

Please sign in to comment.