From: Ian Kent Date: Wed, 22 Jun 2005 00:16:39 +0000 (-0700) Subject: [PATCH] autofs4: post expire race fix X-Git-Tag: v2.6.13-rc4~130^2~202^2~58 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=cc9acc885819696c0ed00f4f0f0cda0c7583f116;p=linux-2.6-omap-h63xx.git [PATCH] autofs4: post expire race fix 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 5a40d36e5a5..fa2348dcd67 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -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 ) {