Bug 1480006 - noisy "remove ioctl failed" messages when attempting to luksClose a still mounted device
noisy "remove ioctl failed" messages when attempting to luksClose a still mou...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cryptsetup (Show other bugs)
7.4
x86_64 Linux
unspecified Severity low
: rc
: ---
Assigned To: Ondrej Kozina
Release Test Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-09 18:18 EDT by Corey Marthaler
Modified: 2018-04-10 12:39 EDT (History)
4 users (show)

See Also:
Fixed In Version: cryptsetup-1.7.4-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 12:38:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0915 None None None 2018-04-10 12:39 EDT

  None (edit)
Description Corey Marthaler 2017-08-09 18:18:47 EDT
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 03:17:21 EDT
> /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 13:57:04 EDT
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 14:18:51 EDT
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 07:32:16 EDT
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 10:29:04 EDT
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 12:38:50 EDT
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.