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 1480006 - noisy "remove ioctl failed" messages when attempting to luksClose a still mounted device
Summary: noisy "remove ioctl failed" messages when attempting to luksClose a still mou...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cryptsetup
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Ondrej Kozina
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-09 22:18 UTC by Corey Marthaler
Modified: 2021-09-06 14:33 UTC (History)
4 users (show)

Fixed In Version: cryptsetup-1.7.4-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 16:38:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0915 0 None None None 2018-04-10 16:39:20 UTC

Description Corey Marthaler 2017-08-09 22:18:47 UTC
Description of problem:

[root@host-093 ~]# cryptsetup -v status virt2_luksvolume
/dev/mapper/virt2_luksvolume is active and is in use.
  type:    LUKS1
  cipher:  aes-xts-plain64
  keysize: 256 bits
  device:  /dev/mapper/snapper_thinp-online_resize
  offset:  4096 sectors
  size:    2093056 sectors
  mode:    read/write
Command successful.

[root@host-093 ~]# mount
/dev/mapper/virt2_luksvolume on /mnt/snap1 type ext4 (rw,relatime,seclabel,stripe=32,data=ordered)

[root@host-093 ~]# cryptsetup luksClose virt2_luksvolume 
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
device-mapper: remove ioctl on virt2_luksvolume  failed: Device or resource busy
Device virt2_luksvolume is still in use.

[root@host-093 ~]# umount /mnt/snap1
[root@host-093 ~]# cryptsetup luksClose virt2_luksvolume


Version-Release number of selected component (if applicable):
3.10.0-693.el7.x86_64

cryptsetup-1.7.4-3.el7   BUILT: Tue 25 Apr 2017 10:08:30 AM CDT
lvm2-2.02.171-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
lvm2-libs-2.02.171-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
lvm2-cluster-2.02.171-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
device-mapper-1.02.140-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
device-mapper-libs-1.02.140-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
device-mapper-event-1.02.140-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
device-mapper-event-libs-1.02.140-8.el7    BUILT: Wed Jun 28 13:28:58 CDT 2017
device-mapper-persistent-data-0.7.0-0.1.rc6.el7    BUILT: Mon Mar 27 10:15:46 CDT 2017


How reproducible:
Everytime

Comment 2 Milan Broz 2017-08-10 07:17:21 UTC
> /dev/mapper/virt2_luksvolume is active and is in use.

If you see "in use" in this status, it means that device-mapper open count is not zero. So something still keeps it open (mapped device, filesystem)...

Please paste lsblk -f or similar command that shows what it is...

Cryptsetup cannot remove open devices, messages are just consequence of repeated tries to remove the device (and these are kernel messages - not sure why we print them in fact, should'n be be debug only?...)

Comment 3 Corey Marthaler 2017-08-10 17:57:04 UTC
This bug is only about removing those ioctl errors when still in use. The "Device virt2_luksvolume is still in use." should be all that needs to be printed.

Comment 4 Milan Broz 2017-08-10 18:18:51 UTC
Ah, ok. This is actually error message (error level) from device mapper library.

You can get exactly the same errors when running
  dmsetup remove --retry virt2_luksvolume

I am not sure if I should hide these messages in cryptsetup. I would prefer libdevmapper to print them in debug level (not _LOG_ERR) with the last unsuccessful message in error level.

Comment 5 Zdenek Kabelac 2017-08-14 11:32:16 UTC
lvm2 detects  in-use device.

See  lvm2 source code function lib/activate/actviate.c  lv_check_not_in_use()
for full details to avoid trying to remove device in-use
(and print nice messages instead).

It does call 2 libdm API calls:

dm_device_has_holders()
dm_device_has_mounted_fs()

so in the end this 'retry' is ONLY used when there is some kind of very unlikely race with udev WATCH rule.

Comment 9 Corey Marthaler 2017-10-26 14:29:04 UTC
Fix verified in the latest build.

cryptsetup-1.7.4-4.el7.x86_64 Built: Thu 19 Oct 2017 08:44:30 AM CDT


[root@host-005 ~]# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/raid_luksvolume      5.9G  5.9G     0 100% /mnt/open_LUKS_fsadm_resize

[root@host-005 ~]# cryptsetup -v status raid_luksvolume
/dev/mapper/raid_luksvolume is active and is in use.
  type:    LUKS1
  cipher:  aes-xts-plain64
  keysize: 256 bits
  device:  /dev/mapper/raid_sanity-open_LUKS_fsadm_resize
  offset:  4096 sectors
  size:    12578816 sectors
  mode:    read/write
Command successful.

[root@host-005 ~]# cryptsetup luksClose raid_luksvolume
Device raid_luksvolume is still in use.

Comment 12 errata-xmlrpc 2018-04-10 16:38:50 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.

https://access.redhat.com/errata/RHBA-2018:0915


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