Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1130168

Summary: DM_DEFERRED_REMOVE support is missing from dmsetup
Product: Red Hat Enterprise Linux 6 Reporter: Alasdair Kergon <agk>
Component: lvm2Assignee: Mikuláš Patočka <mpatocka>
lvm2 sub component: dmsetup (RHEL6) QA Contact: Cluster QE <mspqa-list>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: medium CC: agk, bmarzins, cmarthal, coughlan, dwysocha, heinzm, jbrassow, mpatocka, msnitzer, prajnoha, prockai, rbalakri, tlavigne, xhe, yanwang, zkabelac
Version: 6.6   
Target Milestone: pre-dev-freeze   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.110-1.el6 Doc Type: Enhancement
Doc Text:
dmsetup remove gains a new flag --deferred. If this flag is specified and the device is open, it is scheduled to be deleted later, when it is gets closed.
Story Points: ---
Clone Of: 1109431 Environment:
Last Closed: 2014-10-14 08:25:53 UTC Type: Bug
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: 1109431    
Bug Blocks: 1107315    
Attachments:
Description Flags
The patch to fix this bug
none
The updated patch none

Description Alasdair Kergon 2014-08-14 13:16:37 UTC
+++ This bug was initially created as a clone of Bug #1109431 +++

dmsetup needs to support the DM_DEFERRED_REMOVE kernel option to facilitate testing.

The missing patch is here: http://people.redhat.com/mpatocka/patches/kernel/deferred-remove/userspace-deferred-remove.patch

--- Additional comment from xhe on 2014-08-14 04:53:34 BST ---

I suppose to reproduce this bug like what you supplied in #1. But I found dmsetup doesn't have this argument --deferred.

--- Additional comment from Alasdair Kergon on 2014-08-14 14:08:05 BST ---

Yes, that completely slipped through the net!

It'll have to go through on an lvm2 bugzilla, not a kernel one.

Comment 1 Mikuláš Patočka 2014-08-14 16:16:02 UTC
Created attachment 926857 [details]
The patch to fix this bug

Comment 2 Alasdair Kergon 2014-08-15 02:02:46 UTC
(patch needs a small modification to deal with an ABI break we can easily avoid)

Comment 3 Mikuláš Patočka 2014-08-15 17:44:13 UTC
Created attachment 927190 [details]
The updated patch

A new patch that maintains ABI compatibility.

Comment 12 Corey Marthaler 2014-09-04 23:00:06 UTC
Fix verified using the test case given in bug 1109431.

OLD KERNEL:

2.6.32-495.el6.x86_64
lvm2-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
lvm2-libs-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
lvm2-cluster-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
udev-147-2.57.el6    BUILT: Thu Jul 24 08:48:47 CDT 2014
device-mapper-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-libs-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-event-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-event-libs-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 08:43:06 CDT 2014
cmirror-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014

[root@host-025 ~]# lvcreate --type mirror --alloc anywhere -L 1G -n mirror vg1
  Logical volume "mirror" created
[root@host-025 ~]# mkfs.ext3 /dev/vg1/mirror
mke2fs 1.41.12 (17-May-2010)
[...]
[root@host-025 ~]# mount /dev/vg1/mirror /mnt/mirror/
[root@host-025 ~]# dmsetup remove /dev/vg1/mirror --deferred
[root@host-025 ~]# umount /dev/vg1/mirror 
[HANG]

EXT3-fs (dm-5): mounted filesystem with ordered data mode
------------[ cut here ]------------
WARNING: at kernel/workqueue.c:366 flush_cpu_workqueue+0x8d/0x90() (Not tainted)
Hardware name: KVM
Modules linked in: ext3 jbd dm_raid raid10 raid1 raid456 async_raid6_recov async_pq raid6_pq async_xor xor async_memcpy async_tx dm_snapshot dm_bufio iptable_filter ip_tables autofs4 sg sd_mod crc_t10dif be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi microcode virtio_balloon virtio_net i2c_piix4 i2c_core ext4 jbd2 mbcache virtio_blk virtio_pci virtio_ring virtio pata_acpi ata_generic ata_piix dm_mirror dm_region_hash dm_log dm_mod [last unloaded: speedstep_lib]
Pid: 7, comm: events/0 Not tainted 2.6.32-495.el6.x86_64 #1
Call Trace:
 [<ffffffff81074df7>] ? warn_slowpath_common+0x87/0xc0
 [<ffffffff81074e4a>] ? warn_slowpath_null+0x1a/0x20
 [<ffffffff810983dd>] ? flush_cpu_workqueue+0x8d/0x90
 [<ffffffff8109837a>] ? flush_cpu_workqueue+0x2a/0x90
 [<ffffffff81087fdb>] ? try_to_del_timer_sync+0x7b/0xe0
 [<ffffffff81098e84>] ? flush_workqueue+0x54/0x80
 [<ffffffff81098ec5>] ? flush_scheduled_work+0x15/0x20




NEW KERNEL:

2.6.32-500.el6.x86_64
lvm2-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
lvm2-libs-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
lvm2-cluster-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
udev-147-2.57.el6    BUILT: Thu Jul 24 08:48:47 CDT 2014
device-mapper-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-libs-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-event-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-event-libs-1.02.90-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 08:43:06 CDT 2014
cmirror-2.02.111-2.el6    BUILT: Mon Sep  1 06:46:43 CDT 2014


[root@host-025 ~]# lvcreate --type mirror --alloc anywhere -L 1G -n mirror vg1
  Logical volume "mirror" created
[root@host-025 ~]# mkfs.ext3 /dev/vg1/mirror
mke2fs 1.41.12 (17-May-2010)
[root@host-025 ~]# mount /dev/vg1/mirror /mnt/mirror/
[root@host-025 ~]# dmsetup remove /dev/vg1/mirror* --deferred
[root@host-025 ~]# umount /dev/vg1/mirror 
[root@host-025 ~]# df -h | grep mirror
[root@host-025 ~]# 

Sep  4 17:56:06 host-025 kernel: device-mapper: ioctl: remove_all left 5 open device(s)

Comment 13 errata-xmlrpc 2014-10-14 08:25:53 UTC
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-2014-1387.html