Bug 742607
Summary: | Add wipe_table command to dmsetup to release underlying devices held open | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Aleksandr Brezhnev <brezhnev> |
Component: | lvm2 | Assignee: | Alasdair Kergon <agk> |
Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 6.1 | CC: | agk, cmarthal, coughlan, dwysocha, heinzm, jbrassow, jwest, mbroz, prajnoha, prockai, thornber, zkabelac |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | lvm2-2.02.95-1.el6 | Doc Type: | Bug Fix |
Doc Text: |
dmsetup has a new command "wipe_table" to wipe the table of the device. Any subsequent I/O sent to the device returns errors. Any devices used by the table (i.e. devices to which the I/O is forwarded) are closed.
This could be useful, for example, if a long-running process keeps a device open after it has finished using it and you need to release the underlying devices before that process exits.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2012-06-20 15:00:08 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 756082 |
Description
Aleksandr Brezhnev
2011-09-30 18:13:23 UTC
Currently, we cannot remove a device while it is still open. We cannot remove a device while there is 'stuck' I/O in layers below us. These kernel restrictions are unlikely to be removed. (Would be major upstream work - not really a dm matter.) The dmsetup man page says for --force: if a device can't be removed because an uninterruptible process is waiting for I/O to return from it, adding --force will replace the table with one that fails all I/O, which might allow the process to be killed. Now if the device is still open, but has no I/O and is effectively 'dead', the best you can do is rename it out of the way. However, if you then create a 'new' version of the dm device you will need to give it a different dm uuid as uuids cannot be changed and must be unique. (Reminds me of an old 'chfd' program I used to use, which could have solved this problem - it let you exchange arbitrary fds between processes!) If there is no i/o in flight, a 'dmsetup load' followed by 'dmsetup resume' can be used to replace the table that points to the disk with an 'error' table that would return -EIO for any further I/O sent to the device. This would release the underlying devices, but the dm device itself remains for as long as it remains open. If that solution fits the problem, then it would be easy to provide a new dmsetup command to perform it, saving having to work out (or script) the exact parameters for 'dmsetup load' every time. That command would be 'dmsetup wipe_table' which I've committed upstream. http://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5c9bebee8a0410baebce675c928673e3fb565488 Is it sufficient for your needs? OK, marking this one as resolved. You can still use the "dmsetup remove -f" but this will always return error if that device is still opened. The new "dmsetup wipe_table" will just replace the table with error target, not trying to remove the device itself, so we end up with success. ("remove -f" is actually "wipe_table" + "remove") Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: dmsetup has a new command "wipe_table" to wipe the table of the device. Any subsequent I/O sent to the device returns errors. Any devices used by the table (i.e. devices to which the I/O is forwarded) are closed. This could be useful, for example, if a long-running process keeps a device open after it has finished using it and you need to release the underlying devices before that process exits. Fix verified in the latest rpms. 2.6.32-269.el6.x86_64 lvm2-2.02.95-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 lvm2-libs-2.02.95-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 lvm2-cluster-2.02.95-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 udev-147-2.41.el6 BUILT: Thu Mar 1 13:01:08 CST 2012 device-mapper-1.02.74-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 device-mapper-libs-1.02.74-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 device-mapper-event-1.02.74-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 device-mapper-event-libs-1.02.74-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 cmirror-2.02.95-8.el6 BUILT: Wed May 9 03:33:32 CDT 2012 [root@hayes-01 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/hayes-lv 97M 1.6M 91M 2% /mnt/foo [root@hayes-01 ~]# dmsetup ls hayes-lv (253:3) [root@hayes-01 ~]# dmsetup remove hayes-lv device-mapper: remove ioctl on hayes-lv failed: Device or resource busy Command failed [root@hayes-01 ~]# dmsetup remove -f hayes-lv device-mapper: remove ioctl on hayes-lv failed: Device or resource busy Command failed [root@hayes-01 ~]# dmsetup wipe_table hayes-lv [root@hayes-01 ~]# dmsetup status hayes-lv: 0 204800 error Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0962.html |