Bug 45826 - loopback devices are not detached at shutdown
Summary: loopback devices are not detached at shutdown
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts   
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-06-25 15:48 UTC by chris
Modified: 2014-03-17 02:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-25 15:53:22 UTC
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 15:53 UTC, chris
no flags Details | Diff

Description chris 2001-06-25 15:48:02 UTC
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 15:53:18 UTC
Created attachment 21746 [details]
Patch to detach loopback devices at shutdown

Comment 2 Bill Nottingham 2001-08-07 06:58:00 UTC
Will be fixed in initscripts-6.12-1.

Comment 3 chris 2001-09-25 23:08:36 UTC
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 09:40:24 UTC
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.