Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 15740 - Autofs doesn't load multiple maps with the same timeout
Summary: Autofs doesn't load multiple maps with the same timeout
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal
Assignee: Brad Cowan (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-15 08:44 UTC by Spooky Ghost
Modified: 2003-02-27 23:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for /etc/init.d/autofs (autofs.diff,628 bytes, patch)
2003-02-15 08:51 UTC, Spooky Ghost
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Spooky Ghost 2003-02-15 08:44:09 UTC
The /etc/init.d/autofs script uses the wrong parameter when generating the pid
file in start().  This prevents multiple maps with the same --timeout option
being loaded.  In /var/run the pid file is created as autofs.<timeout value>.pid
not autofs.<mount point>.pid as desired.

In stats() the script looks for automount rather than /usr/sbin/automount in the
process list.

Reproducible: Always
Steps to Reproduce:
1. Create multiple maps e.g auto.home and auto.misc with the same timeout.
2. Restart autofs, only one autofs daemon is started for the first map
3.

Actual Results:  
Only one autofs daemon started for each unique timeout value in start()

The configured daemons but not the running daemons are reported in stats()

Expected Results:  
Started a daemon for each autofs map in start()

Report the running as well as the configured daemons in stats()

I have modified the init script and its behaviour now seems to be as expected. 
This has beem tested with two yp and one file maps.  Patch below:

root@wraith [init.d]$ diff -u autofs.orig autofs
--- autofs.orig 2003-02-15 13:39:23.000000000 +0000
+++ autofs      2003-02-15 11:04:45.000000000 +0000
@@ -135,29 +135,31 @@

 start() {
        ebegin "Starting automounter"
-       getmounts | while read cmd timeout mnt rest
+       getmounts | while read cmd timeout time mnt rest
        do
                #FIXME: this works but it really sucks
                if echo $timeout|grep -v -- '--timeout' >/dev/null ; then
-                       rest="$mnt $rest"
+                       rest="$time $mnt $rest"
                        mnt="$timeout"
+                       time=""
                        timeout=""
                fi

                echo -n " $mnt"
                pidfile=/var/run/autofs`echo $mnt | sed 's/\//./g'`.pid
                start-stop-daemon --start --pidfile $pidfile --quiet \
-                       --exec /usr/sbin/automount -- $timeout $mnt $rest
+                       --exec /usr/sbin/automount -- $timeout $time $mnt $rest
                #
                #       Automount needs a '--pidfile' or '-p' option.
                #       For now we look for the pid ourself.
                #
-               ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout
\?$mnt" | (
+               ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout
$time \?$mnt" | (
                        read pid rest
                        echo $pid > $pidfile
                        echo "$mnt $rest" >> $pidfile
                )
        done
+       echo
        eend $?
 }

@@ -174,7 +176,7 @@
        echo ""
        echo "Active Mount Points:"
        echo "--------------------"
-       ps ax|grep "[0-9]:[0-9][0-9] automount " | (
+       ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
                while read pid tt stat time command; do echo $command; done
        )
 }
Comment 1 Spooky Ghost 2003-02-15 08:51:09 UTC
Created attachment 8299 [details, diff]
Patch for /etc/init.d/autofs
Comment 2 Spooky Ghost 2003-02-15 08:54:21 UTC
Comment on attachment 8299 [details, diff]
Patch for /etc/init.d/autofs

--- autofs.orig 2003-02-15 13:39:23.000000000 +0000
+++ autofs	2003-02-15 11:04:45.000000000 +0000
@@ -135,29 +135,31 @@

 start() {
	ebegin "Starting automounter"
-	getmounts | while read cmd timeout mnt rest
+	getmounts | while read cmd timeout time mnt rest
	do
		#FIXME: this works but it really sucks
		if echo $timeout|grep -v -- '--timeout' >/dev/null ; then
-			rest="$mnt $rest"
+			rest="$time $mnt $rest"
			mnt="$timeout"
+			time=""
			timeout=""
		fi

		echo -n " $mnt"
		pidfile=/var/run/autofs`echo $mnt | sed 's/\//./g'`.pid
		start-stop-daemon --start --pidfile $pidfile --quiet \
-			--exec /usr/sbin/automount -- $timeout $mnt $rest
+			--exec /usr/sbin/automount -- $timeout $time $mnt $rest
		#
		#	Automount needs a '--pidfile' or '-p' option.
		#	For now we look for the pid ourself.
		#
-		ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout
\?$mnt" | (
+		ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout
$time \?$mnt" | (
			read pid rest
			echo $pid > $pidfile
			echo "$mnt $rest" >> $pidfile
		)
	done
+	echo
	eend $?
 }

@@ -174,7 +176,7 @@
	echo ""
	echo "Active Mount Points:"
	echo "--------------------"
-	ps ax|grep "[0-9]:[0-9][0-9] automount " | (
+	ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
		while read pid tt stat time command; do echo $command; done
	)
 }
Comment 3 Brad Cowan (RETIRED) gentoo-dev 2003-02-27 23:02:17 UTC
ok added, thanks