Skip to contentSkip to conversation

autofs 5.0.4 and 5.0.5 do not remove ghost entries upon SIGHUP

DISCUSSION Michael Orlov 2 participants 6 messages Jan 11, 2011 – Jan 14, 2011 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi,

(I have sent this message on Oct 27, but nothing appears in the archives for that month - hopefully it's not a duplicate message.)

I think this is a bug - if it is not, I will be glad if someone corrects me. I am using autofs on Gentoo.

In auto.master, put
/mnt/test /etc/auto.test --ghost

In auto.test, put
floppy -fstype=auto :/dev/fd0
(or anything similar)

1. start autofs
2. see that /mnt/test/floppy exists
3. remove or comment out the "floppy" line in auto.test
4. send SIGHUP to autofs

After these actions, in autofs 5.0.4 / 5.0.5 (but not 5.0.3), /mnt/test/floppy still exists - it is not removed after SIGHUP.

This is problematic, for example, when auto.test is maintained via udev. Full restart of a service from a udev-invoked script is very error-prone.

Thanks,
Michael

maintainer
#1 lore raw
Quoted 7 lines · Michael Orlov

Hi,

(I have sent this message on Oct 27, but nothing appears in the archives for that month - hopefully it's not a duplicate message.)

I think this is a bug - if it is not, I will be glad if someone corrects me. I am using autofs on Gentoo.

You will need to duplicate this with all the current 5.0.5 patches on kernel.org applied to get serious interest in this here.

Quoted 27 lines

In auto.master, put
/mnt/test /etc/auto.test --ghost

In auto.test, put
floppy -fstype=auto :/dev/fd0
(or anything similar)

1. start autofs
2. see that /mnt/test/floppy exists
3. remove or comment out the "floppy" line in auto.test
4. send SIGHUP to autofs

After these actions, in autofs 5.0.4 / 5.0.5 (but not 5.0.3), /mnt/test/floppy still exists - it is not removed after SIGHUP.

This is problematic, for example, when auto.test is maintained via udev. Full restart of a service from a udev-invoked script is very error-prone.

Thanks,
Michael

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#2 lore raw
Quoted 11 lines · Ian Kent
Quoted 7 lines · Michael Orlov

Hi,

(I have sent this message on Oct 27, but nothing appears in the archives for that month - hopefully it's not a duplicate message.)

I think this is a bug - if it is not, I will be glad if someone corrects me. I am using autofs on Gentoo.

You will need to duplicate this with all the current 5.0.5 patches on kernel.org applied to get serious interest in this here.

So I've done that and this patch seems to resolve the problem but I doubt it will apply to the source you are using without some other dependent patches from kernel.org.

autofs-5.0.5 - fix prune cache valid check

From: Ian Kent <[email protected]>

During a map reload, when pruning the cache we look for a valid map entry in another map. In lookup_prune_one_cache() There is a missing check for the entry being in the current map which causes the directory cleanup code from doing its job.
---

 daemon/lookup.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
daemon/lookup.c +8 -0
index a9a1f4d..36e60c9 100644
@@ -1060,6 +1060,14 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
 		 * cache entry.
 		 */
 		valid = lookup_source_valid_mapent(ap, key, LKP_DISTINCT);
+		if (valid && valid->mc == mc) {
+			 /*
+			  * We've found a map entry that has been removed from
+			  * the current cache so it isn't really valid.
+			  */
+			cache_unlock(valid->mc);
+			valid = NULL;
+		}
 		if (!valid &&
 		    is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
 			debug(ap->logopt,
#3 lore raw
Quoted 3 lines

So I've done that and this patch seems to resolve the problem but I doubt it will apply to the source you are using without some other dependent patches from kernel.org.

Gentoo applies the patches listed in
http://kernel.org/pub/linux/daemons/autofs/v5/patch_order-5.0.5 - is that what you mean?

Quoted 1 line

autofs-5.0.5 - fix prune cache valid check

Thanks! Will you be adding the patch to
http://kernel.org/pub/linux/daemons/autofs/v5/ ?

Bets regards,
Michael

maintainer
#4 lore raw
Quoted 7 lines · Michael Orlov
Quoted 3 lines

So I've done that and this patch seems to resolve the problem but I doubt it will apply to the source you are using without some other dependent patches from kernel.org.

Gentoo applies the patches listed in
http://kernel.org/pub/linux/daemons/autofs/v5/patch_order-5.0.5 - is that what you mean?

Yes, but there are a few others I have here.
The patches against this part of the code should all be available on kernel.org so you should be OK.

Quoted 5 lines
Quoted 2 lines

autofs-5.0.5 - fix prune cache valid check

Thanks! Will you be adding the patch to
http://kernel.org/pub/linux/daemons/autofs/v5/ ?

Not until I get feedback as to whether it fixes the issue and a little think time on my part.

Ian

#5 lore raw
Quoted 5 lines
Quoted 2 lines

Thanks! Will you be adding the patch to
http://kernel.org/pub/linux/daemons/autofs/v5/ ?

Not until I get feedback as to whether it fixes the issue and a little think time on my part.

I just tested on Gentoo's net-fs/autofs-5.0.5 + fix-prune-cache-valid-check - works very well, both with the simple test that I described previously, and with a full-blown udev-based solution.

Best regards,
Michael