Prev: [PATCHv2 2/4] mm: cma: Contiguous Memory Allocator added
Next: hda_intel: too quiet sound (regression)
From: David Howells on 26 Jul 2010 10:30 Ian Kent <raven(a)themaw.net> wrote: > > (4) Stops pathwalk at the automount point and returns that point in the fs > > tree if it decides not to automount rather than reporting ELOOP (see its > > use of EXDEV for this). Does it make autofs easier if d_op->d_automount() is allowed to return -EXDEV to request this? Then you can return it in Oz mode to allow the daemon to see/use the underlying mountpoint without recursing back into d_automount(). Ideally, the daemon would use AT_NO_AUTOMOUNT, but there's no way to pass that to sys_mount() or sys_umount(). David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 26 Jul 2010 12:00 Ian Kent <raven(a)themaw.net> wrote: > > Does it make autofs easier if d_op->d_automount() is allowed to return > > -EXDEV to request this? Then you can return it in Oz mode to allow the > > daemon to see/use the underlying mountpoint without recursing back into > > d_automount(). > > Yes, it's really useful. I think what's required, then, is if d_automount() returns -EXDEV then: (1) If the dentry is terminal in the lookup path, then we just return -EXDEV to indicate to __follow_mount() that we really do want to stop there. (2) If the dentry is not terminal, then we convert the error to -EREMOTE to indicate that we can't complete the pathwalk as one of the earlier components is inaccessible. See the attached patch. David --- diff --git a/fs/namei.c b/fs/namei.c index c154112..6c385d4 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -653,8 +653,20 @@ static int follow_automount(struct path *path, unsigned flags, int res) return -ELOOP; mnt = path->dentry->d_op->d_automount(path); - if (IS_ERR(mnt)) + if (IS_ERR(mnt)) { + /* + * The filesystem is allowed to return -EXDEV here to indicate + * they don't want to automount. For instance, autofs would do + * this so that its userspace daemon can mount on this dentry. + * + * However, we can only permit this if it's a terminal point in + * the path being looked up; if it wasn't then the remainder of + * the path is inaccessible and we should say so. + */ + if (PTR_ERR(mnt) == -EXDEV && (flags & LOOKUP_CONTINUE)) + return -EREMOTE; return PTR_ERR(mnt); + } if (!mnt) /* mount collision */ return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 27 Jul 2010 04:50
Ian Kent <raven(a)themaw.net> wrote: > Is this something others need? Not as far as I know... I think autofs is the only one doing out-of-kernel automounting. That doesn't mean it shouldn't be provided, though... > Again, the exists vs not yet exists case for paths within indirect > autofs mounts. At the moment I can just set the flag on all dentrys in > the autofs fs and return EXDEV for non-empty directories in order to > return the dentry as a path component. OTOH if the dentry is a mount > embeded in the path and the mount fails we get a error return. Seems redundant, but I'd say go with it for now. Maybe we can offload S_AUTOMOUNT to the dentry. > I could clear the flag on non-root parent dentrys during mkdir if this > is needed by others. I'm not sure that would actually matter, since it would come to follow_automount() at the same place. Note that someone who tries to stat() with AT_NO_AUTOMOUNT will cause the call to d_automount() to be suppressed and will see the negative or non-mounted directory. That might be okay for you. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |