From: Joseph V Moss <jmoss@ichips.intel.com>
To: jmoyer@redhat.com
Cc: autofs@linux.kernel.org, raven@themaw.net
Subject: Re: [patch] umount loopback filessystems on autofs stop
Date: Thu, 02 Sep 2004 14:20:50 -0700 [thread overview]
Message-ID: <11395.1094160050@ichips.intel.com> (raw)
In-Reply-To: Your message of "Thu, 02 Sep 2004 16:14:42 EDT." <16695.32562.350433.822164@segfault.boston.redhat.com>
Using /proc/mounts could be an issue for anyone trying to use this with a kernel
that truncates /proc/mounts.
> Hello,
>
> The netfs scripts for Red Hat go through and umount any loopback devices
> before attempting to umount the encompassing filesystem. This seems a sane
> thing to do (and I have a bug on said issue), so I've added similar
> functionality to the autofs init script. Attached is a patch. Comments
> encouraged. Testing by debian folks would be nice, too.
>
> -Jeff
>
> --- autofs-4.1.3/samples/rc.autofs.in.umount-loopback 2004-09-02 15:55:21.722705296 -0400
> +++ autofs-4.1.3/samples/rc.autofs.in 2004-09-02 16:16:09.985940440 -0400
> @@ -351,6 +351,31 @@ function signal_automounts()
> return $RETVAL
> }
>
> +function umount_loopback()
> +{
> + loops=`LC_ALL=C awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
> + automounts=`LC_ALL=C awk '!/^#/ && $1 ~ /^automount/ {print $2}' /proc/mounts`
> +
> + for l in $loops
> + do
> + for a in $automounts
> + do
> + command="echo $l | grep -E '^$a'"
> + match=`echo $command | sh`
> + if [ -n "$match" ]; then
> + echo ""
> + echo -n $"Unmounting loopback filesystem $match: "
> + umount -d $match
> + if [ $? -eq 0 ]; then
> + echo "done"
> + else
> + echo "failed ($?)"
> + fi
> + fi
> + done
> + done
> +}
> +
> # Redhat start/stop function.
> #
> function redhat()
> @@ -386,6 +411,7 @@ case "$1" in
> if [ -z "`pidofproc $prog`" -a -z "`getmounts`" ]; then
> RETVAL=0
> else
> + umount_loopback
> signal_automounts
> RETVAL=$?
> fi
> @@ -477,6 +503,7 @@ case "$1" in
> ;;
> stop)
> echo 'Stopping automounter.'
> + umount_loopback
> start-stop-daemon --stop --quiet --signal USR2 --exec $DAEMON
> ;;
> reload|restart)
>
> _______________________________________________
> autofs mailing list
> autofs@linux.kernel.org
> http://linux.kernel.org/mailman/listinfo/autofs
>
next prev parent reply other threads:[~2004-09-02 21:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-02 20:14 [patch] umount loopback filessystems on autofs stop Jeff Moyer
2004-09-02 21:20 ` Joseph V Moss [this message]
2004-09-03 2:31 ` Mike Waychison
2004-09-03 9:03 ` James Pearson
2004-09-03 12:30 ` Mike Waychison
-- strict thread matches above, loose matches on Subject: below --
2004-09-03 2:46 Lever, Charles
2004-09-03 14:17 ` Jeff Moyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11395.1094160050@ichips.intel.com \
--to=jmoss@ichips.intel.com \
--cc=autofs@linux.kernel.org \
--cc=jmoyer@redhat.com \
--cc=raven@themaw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.