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.
shutdown results in "Device or resource busy" from umount2 and "device is bus...
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks: FC4Target
  Show dependency treegraph
 
Reported: 2005-02-05 03:52 EST by James Hunt
Modified: 2014-03-16 22:52 EDT (History)
2 users (show)

See Also:
Fixed In Version: 8.08-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-04-15 16:07:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Hunt 2005-02-05 03:52:33 EST
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 16:07:16 EDT
Added in 8.08-1.

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