Bug 718739 - /etc/init.d/halt:__umount_loop() skips autofs, breaking halt and reboot
Summary: /etc/init.d/halt:__umount_loop() skips autofs, breaking halt and reboot
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 14
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-04 13:19 UTC by Frank van Maarseveen
Modified: 2014-03-17 03:28 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-20 10:11:46 UTC
Type: ---


Attachments (Terms of Use)

Description Frank van Maarseveen 2011-07-04 13:19:58 UTC
Description of problem:

The "halt" and "reboot" commands fail to umount a remaining autofs
mount which could not be umounted at the time autofs was stopped
by initscripts. When autofs is configured to mount a tree (e.g. in a
/etc/auto.net setup) then submounts are done on top of an autofs mount for
that same mountpoint. So, not only the remaining mounts via autofs but
also internal autofs mounts need to be umounted. Unfortunately the shell
function __umount_loop() in /etc/init.d/halt skips autofs. Fix is to not
make an exception there for autofs.

An optimized /etc/auto.net script (a program map) uses bind mounts
when the local host is involved. Example output of such a script with
'localhost' as argument:

        /       :/ \
        /home   :/home \

command sequence to trigger issue:

	cd /net/localhost/home
	sleep 123456 >foo &	# keep it in use
	cd
	reboot			# as root

/proc/mounts after stopping autofs manually looks as follows (edited to
clarify a bit):

	/dev/sda1 / ext4 ...
	/dev/sda2 /home ext4 ...
	...
	/dev/sda1 /net/localhost ext4 ...
	/etc/auto.net /net/localhost/home autofs ...
	/dev/sda2 /net/localhost/home ext4 ...

Halt and reboot will end up executing __umount_loop() and thus:

	fuser -k -m /net/localhost >/dev/null

because /net/localhost cannot be umounted (in use by autofs submount).
Now because fuser doesn't understand bind mounts above fuser command
will kill every process on the system including initscripts.
Removing the autofs exception in /etc/init.d/halt fixes the problem.

Version-Release number of selected component (if applicable):

	9.20.0-1.fc14.1

How reproducible:

	very well

Steps to Reproduce:

	See above
  
Actual results:

	initscript (fuser actually) prints:

		crcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcr

	with an occasional 'e' in between and reboot/halt stops forever with
	filesystems still mounted r/w.

Expected results:

	reboot/halt

Additional info:

	initscripts and its use of fuser is broken w.r.t. bind
	mounts. killing all processes which have files open or a current
	working directory beneath some path is easy (e.g. in python
	by reading /proc) and could replace fuser.

Comment 1 Bill Nottingham 2011-07-05 18:46:13 UTC
This is 'fixed' in F-15 and later by not using this code, and using systemd. Obviously that doesn't really help Fedora 14, though.


Note You need to log in before you can comment on or make changes to this bug.