Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
autofs: add comment about autofs_mountpoint_changed()
Browse files Browse the repository at this point in the history
The function autofs_mountpoint_changed() is unusual, add a comment about
two cases for which it is needed.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ian Kent <[email protected]>
Cc: Al Viro <[email protected]>
Cc: David Howells <[email protected]>
Cc: Miklos Szeredi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
raven-au authored and akpm00 committed Jul 18, 2022
1 parent a4a8730 commit ba97a0a
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions fs/autofs/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,26 @@ static struct dentry *autofs_mountpoint_changed(struct path *path)
struct dentry *dentry = path->dentry;
struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);

/*
* If this is an indirect mount the dentry could have gone away
* as a result of an expire and a new one created.
/* If this is an indirect mount the dentry could have gone away
* and a new one created.
*
* This is unusual and I can't remember the case for which it
* was originally added now. But an example of how this can
* happen is an autofs indirect mount that has the "browse"
* option set and also has the "symlink" option in the autofs
* map entry. In this case the daemon will remove the browse
* directory and create a symlink as the mount leaving the
* struct path stale.
*
* Another not so obvious case is when a mount in an autofs
* indirect mount that uses the "nobrowse" option is being
* expired at the same time as a path walk. If the mount has
* been umounted but the mount point directory seen before
* becoming unhashed (during a lockless path walk) when a stat
* family system call is made the mount won't be re-mounted as
* it should. In this case the mount point that's been removed
* (by the daemon) will be stale and the a new mount point
* dentry created.
*/
if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
struct dentry *parent = dentry->d_parent;
Expand Down

0 comments on commit ba97a0a

Please sign in to comment.