Bug 45826 - loopback devices are not detached at shutdown
loopback devices are not detached at shutdown
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-25 11:48 EDT by chris
Modified: 2014-03-16 22:21 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-25 11:53:22 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)
Patch to detach loopback devices at shutdown (455 bytes, patch)
2001-06-25 11:53 EDT, chris
no flags Details | Diff

  None (edit)
Description chris 2001-06-25 11:48:02 EDT
At system shutdown, /etc/rc.d/init.d/halt unmounts any loopback devices
which are currently mounted, but it doesn't then detach those devices. 
This means that the filesystem on which the file resides which is being
loopback mounted cannot itself be unmounted.

It's easy to reproduce this by doing, for example:

  losetup /dev/loop1 /root/some/data/file
  mount /dev/loop1 /tmp/mountpoint
  /sbin/shutdown -r now

The loop device stays attached to /root/some/data/file.

Patch attached to fix this (though it's probably not the best way of doing
it).
Comment 1 chris 2001-06-25 11:53:18 EDT
Created attachment 21746 [details]
Patch to detach loopback devices at shutdown
Comment 2 Bill Nottingham 2001-08-07 02:58:00 EDT
Will be fixed in initscripts-6.12-1.
Comment 3 chris 2001-09-25 19:08:36 EDT
Thanks.  The code in the current rawhide initscripts-6.39-1 still doesn't quite
work correctly, though.  It's OK if the loopback devices are mounted, but it
doesn't work for attached but not mounted loopback devices.

My patch above does work in these circumstances.
Comment 4 Petko Alov 2002-07-25 05:40:24 EDT
The patch 21746 is not properly included in /etc/rc.d/init.d/halt from 
initscripts-5.84.1-1; because of typo in variable name in line 144 ($device 
instead of $dev) loopback devices can't be detached:

142:	for dev in $devremaining ; do
143:	losetup $dev > /dev/null 2>&1 && \
144:	runcmd $"Detaching loopback device $dev: " losetup -d $device
145:	done

should be:

142:	for dev in $devremaining ; do
143:	losetup $dev > /dev/null 2>&1 && \
144:	runcmd $"Detaching loopback device $dev: " losetup -d $dev
145:	done

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