Bug 147254 - shutdown results in "Device or resource busy" from umount2 and "device is busy" messages from umount when a filesystem is mounted on top of another filesystem.
Summary: shutdown results in "Device or resource busy" from umount2 and "device is bus...
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: FC4Target
TreeView+ depends on / blocked
 
Reported: 2005-02-05 08:52 UTC by James Hunt
Modified: 2014-03-17 02:52 UTC (History)
2 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2005-04-15 20:07:16 UTC


Attachments (Terms of Use)

Description James Hunt 2005-02-05 08:52:33 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
If you create any filesystems that are mounted below a directory other
than the root directory, Fedora will barf on shutdown. For example,
if I create and mount filesystems "/hello" and "/hello/world",
shutdown gives a message like this:

------------------------------------
umount2: Device or resource busy
umount: /hello: device is busy
umount2: Device or resource busy
umount: /hello: device is busy
------------------------------------


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

How reproducible:
Always

Steps to Reproduce:
1. mount a filesystem as "/hello".
2. mount a filesystem as "/hello/world".
3. run, "shutdown -h now".
4. watch the console.
    

Actual Results:  
------------------------------------
umount2: Device or resource busy
umount: /hello: device is busy
umount2: Device or resource busy
umount: /hello: device is busy
------------------------------------

There is then a delay until the machine forcibly reboots. As such,
this bug is causing an unnecessary performance problem.

Expected Results:  I would expect no output and no errors from the
umount commands.

Additional info:

The problem appears to lie in "/etc/init.d/halt" line 201:

------------------------------------
# Try all file systems other than root and RAM disks, one last time.
mount |  awk '!/( \/ |^\/dev\/root|^\/dev\/ram| \/proc )/ { print $3 }'
| \
  while read line; do
    umount -f $line
done
------------------------------------
This code is incorrect since it does not reverse the order of the
mounts as returned by the "mount" command. As such, if I have these
two filesystems mounted:

/hello
/hello/world

The code will fail to unmount "/hello" (since "/hello/world" is still
mounted), but will succeed in unmounting "/hello/world".

The fix is to reverse sort the output:

------------------------------------
# Try all file systems other than root and RAM disks, one last time.
mount |  awk '!/( \/ |^\/dev\/root|^\/dev\/ram| \/proc )/ { print $3 }'
| sort -r \
  while read line; do
    umount -f $line
done
------------------------------------

Comment 1 Bill Nottingham 2005-04-15 20:07:16 UTC
Added in 8.08-1.


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