* AutoFS creates unmountable directories when ghosting is enabled
@ 2010-12-10 19:10 Leonardo Chiquitto
2010-12-15 2:49 ` Ian Kent
0 siblings, 1 reply; 6+ messages in thread
From: Leonardo Chiquitto @ 2010-12-10 19:10 UTC (permalink / raw)
To: autofs
Hello Ian and list,
I'd like to forward a bug report we received on openSUSE's Bugzilla [1].
Please consider the following setup to reproduce the problem:
host:~ # grep automount /etc/nsswitch.conf
automount: files
host:~ # cat /etc/auto.master
/vol /etc/auto.vol
host:~ # cat /etc/auto.vol
data1 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data1
data2 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data2
data3 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data3
host:~ # cat /etc/sysconfig/autofs
AUTOFS_OPTIONS=""
LOCAL_OPTIONS=""
APPEND_OPTIONS="yes"
DEFAULT_MASTER_MAP_NAME="auto.master"
DEFAULT_TIMEOUT=600
DEFAULT_BROWSE_MODE="yes"
DEFAULT_LOGGING="debug"
USE_MISC_DEVICE="yes"
host:~ # ls -F /vol
data1/ data2/ data3/
The problem depends on ghosting being enabled (ie, BROWSE_MODE=yes).
When we try to access a non-existent key/entry, AutoFS will fail to mount
it but will still create the mount point:
host:~ # ls -d /vol/invalid; sleep 10; ls -d /vol/invalid
ls: cannot access /vol/invalid: No such file or directory
/vol/invalid
host:~ # ls -F /vol
data1/ data2/ data3/ invalid/
The problem happens because lookup_ghost() iterates over all cached
mapents and creates directories for each entry in the cache. Since
the cache also stores entries for failed mounts (negative entries), it
ends up creating directories for mount points that don't exist in the
map.
I tested the patch below and it resolves the problem for me, but I'm not
sure if this is the best (or even the correct) way to fix the bug. I'd
appreciate if you could review and comment.
Thanks,
Leonardo
[1] https://bugzilla.novell.com/show_bug.cgi?id=658734
When ghosting is enabled, don't create mount points for cached entries
that don't have a valid mapent.
Index: autofs-5.0.5/daemon/lookup.c
===================================================================
--- autofs-5.0.5.orig/daemon/lookup.c
+++ autofs-5.0.5/daemon/lookup.c
@@ -604,6 +604,9 @@ int lookup_ghost(struct autofs_point *ap
if (!strcmp(me->key, "*"))
goto next;
+ if (!me->mapent)
+ goto next;
+
if (*me->key == '/') {
/* It's a busy multi-mount - leave till next time */
if (list_empty(&me->multi_list))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AutoFS creates unmountable directories when ghosting is enabled
2010-12-10 19:10 AutoFS creates unmountable directories when ghosting is enabled Leonardo Chiquitto
@ 2010-12-15 2:49 ` Ian Kent
2011-03-07 2:37 ` Leonardo Chiquitto
0 siblings, 1 reply; 6+ messages in thread
From: Ian Kent @ 2010-12-15 2:49 UTC (permalink / raw)
To: Leonardo Chiquitto; +Cc: autofs
On Fri, 2010-12-10 at 17:10 -0200, Leonardo Chiquitto wrote:
> Hello Ian and list,
>
> I'd like to forward a bug report we received on openSUSE's Bugzilla [1].
> Please consider the following setup to reproduce the problem:
>
> host:~ # grep automount /etc/nsswitch.conf
> automount: files
>
> host:~ # cat /etc/auto.master
> /vol /etc/auto.vol
>
> host:~ # cat /etc/auto.vol
> data1 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data1
> data2 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data2
> data3 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data3
>
> host:~ # cat /etc/sysconfig/autofs
> AUTOFS_OPTIONS=""
> LOCAL_OPTIONS=""
> APPEND_OPTIONS="yes"
> DEFAULT_MASTER_MAP_NAME="auto.master"
> DEFAULT_TIMEOUT=600
> DEFAULT_BROWSE_MODE="yes"
> DEFAULT_LOGGING="debug"
> USE_MISC_DEVICE="yes"
>
> host:~ # ls -F /vol
> data1/ data2/ data3/
>
> The problem depends on ghosting being enabled (ie, BROWSE_MODE=yes).
> When we try to access a non-existent key/entry, AutoFS will fail to mount
> it but will still create the mount point:
>
> host:~ # ls -d /vol/invalid; sleep 10; ls -d /vol/invalid
> ls: cannot access /vol/invalid: No such file or directory
> /vol/invalid
>
> host:~ # ls -F /vol
> data1/ data2/ data3/ invalid/
>
> The problem happens because lookup_ghost() iterates over all cached
> mapents and creates directories for each entry in the cache. Since
> the cache also stores entries for failed mounts (negative entries), it
> ends up creating directories for mount points that don't exist in the
> map.
Yes, an obvious problem.
>
> I tested the patch below and it resolves the problem for me, but I'm not
> sure if this is the best (or even the correct) way to fix the bug. I'd
> appreciate if you could review and comment.
Yeah, at first I thought there were a few other cases.
There still might be so let me think about it further.
>
> Thanks,
> Leonardo
>
> [1] https://bugzilla.novell.com/show_bug.cgi?id=658734
>
> When ghosting is enabled, don't create mount points for cached entries
> that don't have a valid mapent.
>
> Index: autofs-5.0.5/daemon/lookup.c
> ===================================================================
> --- autofs-5.0.5.orig/daemon/lookup.c
> +++ autofs-5.0.5/daemon/lookup.c
> @@ -604,6 +604,9 @@ int lookup_ghost(struct autofs_point *ap
> if (!strcmp(me->key, "*"))
> goto next;
>
> + if (!me->mapent)
> + goto next;
> +
> if (*me->key == '/') {
> /* It's a busy multi-mount - leave till next time */
> if (list_empty(&me->multi_list))
>
> _______________________________________________
> autofs mailing list
> autofs@linux.kernel.org
> http://linux.kernel.org/mailman/listinfo/autofs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AutoFS creates unmountable directories when ghosting is enabled
2010-12-15 2:49 ` Ian Kent
@ 2011-03-07 2:37 ` Leonardo Chiquitto
2011-03-09 4:15 ` Ian Kent
0 siblings, 1 reply; 6+ messages in thread
From: Leonardo Chiquitto @ 2011-03-07 2:37 UTC (permalink / raw)
To: Ian Kent; +Cc: autofs
On Wed, Dec 15, 2010 at 12:49 AM, Ian Kent <raven@themaw.net> wrote:
> On Fri, 2010-12-10 at 17:10 -0200, Leonardo Chiquitto wrote:
>> Hello Ian and list,
>>
>> I'd like to forward a bug report we received on openSUSE's Bugzilla [1].
>> Please consider the following setup to reproduce the problem:
>>
>> host:~ # grep automount /etc/nsswitch.conf
>> automount: files
>>
>> host:~ # cat /etc/auto.master
>> /vol /etc/auto.vol
>>
>> host:~ # cat /etc/auto.vol
>> data1 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data1
>> data2 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data2
>> data3 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data3
>>
>> host:~ # cat /etc/sysconfig/autofs
>> AUTOFS_OPTIONS=""
>> LOCAL_OPTIONS=""
>> APPEND_OPTIONS="yes"
>> DEFAULT_MASTER_MAP_NAME="auto.master"
>> DEFAULT_TIMEOUT=600
>> DEFAULT_BROWSE_MODE="yes"
>> DEFAULT_LOGGING="debug"
>> USE_MISC_DEVICE="yes"
>>
>> host:~ # ls -F /vol
>> data1/ data2/ data3/
>>
>> The problem depends on ghosting being enabled (ie, BROWSE_MODE=yes).
>> When we try to access a non-existent key/entry, AutoFS will fail to mount
>> it but will still create the mount point:
>>
>> host:~ # ls -d /vol/invalid; sleep 10; ls -d /vol/invalid
>> ls: cannot access /vol/invalid: No such file or directory
>> /vol/invalid
>>
>> host:~ # ls -F /vol
>> data1/ data2/ data3/ invalid/
>>
>> The problem happens because lookup_ghost() iterates over all cached
>> mapents and creates directories for each entry in the cache. Since
>> the cache also stores entries for failed mounts (negative entries), it
>> ends up creating directories for mount points that don't exist in the
>> map.
>
> Yes, an obvious problem.
>
>>
>> I tested the patch below and it resolves the problem for me, but I'm not
>> sure if this is the best (or even the correct) way to fix the bug. I'd
>> appreciate if you could review and comment.
>
> Yeah, at first I thought there were a few other cases.
> There still might be so let me think about it further.
Hello Ian,
I bisected this problem today and discovered that it appeared after the
following commit:
commit 08aafab4c1d0ab6227c80f8cd1086ae78556a370
Author: Ian Kent <raven@themaw.net>
Date: Thu Sep 9 11:10:47 2010 +0800
autofs-5.0.5 - fix direct map not updating on reread
If the map type is explicitly specified for a map the map isn't
properly updated when a re-read is requested. This is because
the map stale flag is incorrectly cleared after after the lookup
module reads the map instead of at the completion of the update
procedure. The map stale flag should only be cleared if the map
read fails for some reason, otherwise it is updated when the
refresh is completed.
Does this ring a bell? If not, I'll see if I can debug it further tomorrow.
Thanks,
Leonardo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AutoFS creates unmountable directories when ghosting is enabled
2011-03-07 2:37 ` Leonardo Chiquitto
@ 2011-03-09 4:15 ` Ian Kent
2011-03-09 4:21 ` Ian Kent
0 siblings, 1 reply; 6+ messages in thread
From: Ian Kent @ 2011-03-09 4:15 UTC (permalink / raw)
To: Leonardo Chiquitto; +Cc: autofs
On Sun, 2011-03-06 at 23:37 -0300, Leonardo Chiquitto wrote:
> On Wed, Dec 15, 2010 at 12:49 AM, Ian Kent <raven@themaw.net> wrote:
> > On Fri, 2010-12-10 at 17:10 -0200, Leonardo Chiquitto wrote:
> >> Hello Ian and list,
> >>
> >> I'd like to forward a bug report we received on openSUSE's Bugzilla [1].
> >> Please consider the following setup to reproduce the problem:
> >>
> >> host:~ # grep automount /etc/nsswitch.conf
> >> automount: files
> >>
> >> host:~ # cat /etc/auto.master
> >> /vol /etc/auto.vol
> >>
> >> host:~ # cat /etc/auto.vol
> >> data1 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data1
> >> data2 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data2
> >> data3 -fstype=nfs,ro,rsize=8192,wsize=8192,intr,nolock,nosuid srv:/data3
> >>
> >> host:~ # cat /etc/sysconfig/autofs
> >> AUTOFS_OPTIONS=""
> >> LOCAL_OPTIONS=""
> >> APPEND_OPTIONS="yes"
> >> DEFAULT_MASTER_MAP_NAME="auto.master"
> >> DEFAULT_TIMEOUT=600
> >> DEFAULT_BROWSE_MODE="yes"
> >> DEFAULT_LOGGING="debug"
> >> USE_MISC_DEVICE="yes"
> >>
> >> host:~ # ls -F /vol
> >> data1/ data2/ data3/
> >>
> >> The problem depends on ghosting being enabled (ie, BROWSE_MODE=yes).
> >> When we try to access a non-existent key/entry, AutoFS will fail to mount
> >> it but will still create the mount point:
> >>
> >> host:~ # ls -d /vol/invalid; sleep 10; ls -d /vol/invalid
> >> ls: cannot access /vol/invalid: No such file or directory
> >> /vol/invalid
> >>
> >> host:~ # ls -F /vol
> >> data1/ data2/ data3/ invalid/
> >>
> >> The problem happens because lookup_ghost() iterates over all cached
> >> mapents and creates directories for each entry in the cache. Since
> >> the cache also stores entries for failed mounts (negative entries), it
> >> ends up creating directories for mount points that don't exist in the
> >> map.
> >
> > Yes, an obvious problem.
> >
> >>
> >> I tested the patch below and it resolves the problem for me, but I'm not
> >> sure if this is the best (or even the correct) way to fix the bug. I'd
> >> appreciate if you could review and comment.
> >
> > Yeah, at first I thought there were a few other cases.
> > There still might be so let me think about it further.
>
> Hello Ian,
>
> I bisected this problem today and discovered that it appeared after the
> following commit:
>
> commit 08aafab4c1d0ab6227c80f8cd1086ae78556a370
> Author: Ian Kent <raven@themaw.net>
> Date: Thu Sep 9 11:10:47 2010 +0800
>
> autofs-5.0.5 - fix direct map not updating on reread
>
> If the map type is explicitly specified for a map the map isn't
> properly updated when a re-read is requested. This is because
> the map stale flag is incorrectly cleared after after the lookup
> module reads the map instead of at the completion of the update
> procedure. The map stale flag should only be cleared if the map
> read fails for some reason, otherwise it is updated when the
> refresh is completed.
>
> Does this ring a bell? If not, I'll see if I can debug it further tomorrow.
Not really.
I'm still not sure your original patch deals with the problem fully.
Could you also have a look at and try (from kernel.org):
autofs-5.0.5-fix-prune-cache-valid-check.patch
Ian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AutoFS creates unmountable directories when ghosting is enabled
2011-03-09 4:15 ` Ian Kent
@ 2011-03-09 4:21 ` Ian Kent
2011-03-09 14:09 ` Leonardo Chiquitto
0 siblings, 1 reply; 6+ messages in thread
From: Ian Kent @ 2011-03-09 4:21 UTC (permalink / raw)
To: Leonardo Chiquitto; +Cc: autofs
On Wed, 2011-03-09 at 12:15 +0800, Ian Kent wrote:
> >
> > Hello Ian,
> >
> > I bisected this problem today and discovered that it appeared after the
> > following commit:
> >
> > commit 08aafab4c1d0ab6227c80f8cd1086ae78556a370
> > Author: Ian Kent <raven@themaw.net>
> > Date: Thu Sep 9 11:10:47 2010 +0800
> >
> > autofs-5.0.5 - fix direct map not updating on reread
> >
> > If the map type is explicitly specified for a map the map isn't
> > properly updated when a re-read is requested. This is because
> > the map stale flag is incorrectly cleared after after the lookup
> > module reads the map instead of at the completion of the update
> > procedure. The map stale flag should only be cleared if the map
> > read fails for some reason, otherwise it is updated when the
> > refresh is completed.
> >
> > Does this ring a bell? If not, I'll see if I can debug it further tomorrow.
>
> Not really.
> I'm still not sure your original patch deals with the problem fully.
>
> Could you also have a look at and try (from kernel.org):
> autofs-5.0.5-fix-prune-cache-valid-check.patch
Although, looking again, maybe we need both patches.
>
> Ian
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AutoFS creates unmountable directories when ghosting is enabled
2011-03-09 4:21 ` Ian Kent
@ 2011-03-09 14:09 ` Leonardo Chiquitto
0 siblings, 0 replies; 6+ messages in thread
From: Leonardo Chiquitto @ 2011-03-09 14:09 UTC (permalink / raw)
To: Ian Kent; +Cc: autofs
On Wed, Mar 9, 2011 at 1:21 AM, Ian Kent <raven@themaw.net> wrote:
> On Wed, 2011-03-09 at 12:15 +0800, Ian Kent wrote:
>> >
>> > Hello Ian,
>> >
>> > I bisected this problem today and discovered that it appeared after the
>> > following commit:
>> >
>> > commit 08aafab4c1d0ab6227c80f8cd1086ae78556a370
>> > Author: Ian Kent <raven@themaw.net>
>> > Date: Thu Sep 9 11:10:47 2010 +0800
>> >
>> > autofs-5.0.5 - fix direct map not updating on reread
>> >
>> > If the map type is explicitly specified for a map the map isn't
>> > properly updated when a re-read is requested. This is because
>> > the map stale flag is incorrectly cleared after after the lookup
>> > module reads the map instead of at the completion of the update
>> > procedure. The map stale flag should only be cleared if the map
>> > read fails for some reason, otherwise it is updated when the
>> > refresh is completed.
>> >
>> > Does this ring a bell? If not, I'll see if I can debug it further tomorrow.
>>
>> Not really.
>> I'm still not sure your original patch deals with the problem fully.
>>
>> Could you also have a look at and try (from kernel.org):
>> autofs-5.0.5-fix-prune-cache-valid-check.patch
>
> Although, looking again, maybe we need both patches.
Yes, I tested again with all kernel.org patches and the problem remains.
Leonardo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-09 14:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 19:10 AutoFS creates unmountable directories when ghosting is enabled Leonardo Chiquitto
2010-12-15 2:49 ` Ian Kent
2011-03-07 2:37 ` Leonardo Chiquitto
2011-03-09 4:15 ` Ian Kent
2011-03-09 4:21 ` Ian Kent
2011-03-09 14:09 ` Leonardo Chiquitto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.