On Sat, 2011-06-18 at 01:11 +0100, David Howells wrote:
> autofs4_d_automount() returns 0 if it detects that the calling process is in 
> Oz
> mode (ie. it's the autofs userspace daemon).  This return, however, is meant 
> to
> indicate to follow_automount() that the caller should retry the check on the
> the current path point.  In the Oz mode case, this is a bad idea because
> nothing has changed on the path, and follow_managed() will just repeat until
> follow_automount() hits the total_link_count limit and returns -ELOOP.
> 
> What it should do is return -EISDIR to indicate to the callers that actually 
> it
> wants the daemon to see this directory as an ordinary directory.

No, not unless the check below can be changed to somehow not trigger
when LOOKUP_CONTINUE is set for autofs automount dentrys that don't
actually end up with a mount on them, but are automount triggers never
the less:

               if (PTR_ERR(mnt) == -EISDIR && (flags & LOOKUP_CONTINUE))
                        return -EREMOTE;
                return PTR_ERR(mnt);

Fact is in our discussions on this we could never reach agreement so I
worked around it by breaking out of the follow_managed() loop using
->d_managed() instead, thinking that the above check must remain to
satisfy the needs of other kernel users.

> 
> 
> Now, given that change outlined above, it is then unnecessary for
> autofs4_d_manage() to return -EISDIR if the current path point is not a
> mountpoint.  If it returns 0 instead, and the path point isn't a mountpoint,
> then follow_managed() will skip the attempt to transit to the mounted
> filesystem and proceed to call autofs4_d_automount(), which will return
> -EISDIR.
> 
> Signed-off-by: David Howells <dhowe...@redhat.com>
> ---
> 
>  fs/autofs4/root.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
> index f55ae23..a6dc11c 100644
> --- a/fs/autofs4/root.c
> +++ b/fs/autofs4/root.c
> @@ -334,7 +334,7 @@ static struct vfsmount *autofs4_d_automount(struct path 
> *path)
>  
>       /* The daemon never triggers a mount. */
>       if (autofs4_oz_mode(sbi))
> -             return NULL;
> +             return ERR_PTR(-EISDIR);
>  
>       /*
>        * If an expire request is pending everyone must wait.
> @@ -435,13 +435,8 @@ int autofs4_d_manage(struct dentry *dentry, bool 
> rcu_walk)
>               dentry, dentry->d_name.len, dentry->d_name.name);
>  
>       /* The daemon never waits. */
> -     if (autofs4_oz_mode(sbi)) {
> -             if (rcu_walk)
> -                     return 0;
> -             if (!d_mountpoint(dentry))
> -                     return -EISDIR;
> +     if (autofs4_oz_mode(sbi))
>               return 0;
> -     }
>  
>       /* We need to sleep, so we need pathwalk to be in ref-mode */
>       if (rcu_walk)
> 


_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to