Commit 9d2de6ad authored by Jeff Moyer's avatar Jeff Moyer Committed by Linus Torvalds

autofs4: fix incorrect return from root.c:try_to_fill_dentry()

Jeff Moyer has identified a case where the autofs4 function
root.c:try_to_fill_dentry() can return -EBUSY when it should return 0.

Jeff's description of the way this happens is:

"automount starts an expire for directory d.  after the callout to the daemon,
but before the rmdir, another process tries to walk into the same directory.
It puts itself onto the waitq, pending the expiration.

When the expire finishes, the second process is woken up.  In
try_to_fill_dentry, it does this check:

                status = d_invalidate(dentry);
                if (status != -EBUSY)
                        return -EAGAIN;

And status is EBUSY.  The dentry still has a non-zero d_inode, and the
flags do not contain LOOKUP_CONTINUE or LOOKUP_DIRECTORY

So, we fall through and return -EBUSY to the caller."
Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 03379044
...@@ -243,7 +243,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) ...@@ -243,7 +243,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct autofs_info *ino = autofs4_dentry_ino(dentry); struct autofs_info *ino = autofs4_dentry_ino(dentry);
struct dentry *new; struct dentry *new;
int status = 0; int status;
/* Block on any pending expiry here; invalidate the dentry /* Block on any pending expiry here; invalidate the dentry
when expiration is done to trigger mount request with a new when expiration is done to trigger mount request with a new
...@@ -340,7 +340,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) ...@@ -340,7 +340,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
} }
} }
return status; return 0;
} }
/* For autofs direct mounts the follow link triggers the mount */ /* For autofs direct mounts the follow link triggers the mount */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment