Bug 1410743 - blkdeactivate does not umount software raid prior to deactivating it
Summary: blkdeactivate does not umount software raid prior to deactivating it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On: 1410585
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-06 10:27 UTC by Peter Rajnoha
Modified: 2017-08-01 21:49 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.169-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1410585
Environment:
Last Closed: 2017-08-01 21:49:49 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2222 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2017-08-01 18:42:41 UTC

Description Peter Rajnoha 2017-01-06 10:27:38 UTC
+++ This bug was initially created as a clone of Bug #1410585 +++

Description of problem: /usr/sbin/blkdeactivate is called during shutdown/reboot to umount and deactivate any lvm or dmraid block devices. With the update in RHEL/CentOS 7.3, it now also deactivates software raid devices.  However, the unmount function was not updated to unmount software raid devices prior to deactivating them.

This is causing an issue with the system not shutting down or rebooting when it is set up with a software RAID1 for /boot and the rest of the system with ZFS (using the zfs on linux repo).

I've included a patch to fix it.

Version-Release number of selected component (if applicable):
1.02.135-1.el7_3.1.x86_64

How reproducible:
Issue occurs every shutdown/reboot when using ZFS root.

I'd suspect this issue could also lead to corruption of filesystems on software RAID devices since it deactivates the underlying md device without unmounting it first.

Steps to Reproduce:
1. Install system with ZFS root and software raid 1 for /boot
2. Reboot or shutdown system
3.

Actual results:
system loops in shutdown with kernel errors regarding ZFS being out of memory

Expected results:
clean shutdown/reboot

Additional info:
I've diagnosed and solved the problem.  Patch is attached.

--- Additional comment from Peter Rajnoha on 2017-01-06 11:25:09 CET ---

Thanks for the diagnosis and a patch! However, I've changed the patch a bit to check the device's kernel name for "md" instead of checking "raidN" type because that can be also used for devices other than MD itself.

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=d90320f4f161658c6a004631c5685b40202af2cc

https://www.redhat.com/archives/lvm-devel/2017-January/msg00015.html

Comment 3 Roman Bednář 2017-04-18 14:57:48 UTC
Verified. 'blkdeactivate -u' now unmounts md raid devices as well.

BEFORE PATCH
# mount | tail -n 1
/dev/md0 on /mnt/test type ext4 (rw,relatime,seclabel,stripe=2048,data=ordered)
# blkdeactivate -u
Deactivating block devices:
  [SKIP]: unmount of rhel_virt--365-swap (dm-1) mounted on [SWAP]
  [SKIP]: unmount of rhel_virt--365-root (dm-0) mounted on /
  [MD]: deactivating raid1 device md0... skipping
# mount | grep test
/dev/md0 on /mnt/test type ext4 (rw,relatime,seclabel,stripe=2048,data=ordered)

AFTER PATCH
# mount | tail -n 1
/dev/md0 on /mnt/test type ext4 (rw,relatime,seclabel,stripe=2048,data=ordered)
# blkdeactivate -u
Deactivating block devices:
  [SKIP]: unmount of rhel_virt--362-swap (dm-1) mounted on [SWAP]
  [UMOUNT]: unmounting md0 (md0) mounted on /mnt/test... done
  [SKIP]: unmount of rhel_virt--362-root (dm-0) mounted on /
  [MD]: deactivating raid1 device md0... done



3.10.0-647.el7.x86_64

lvm2-2.02.169-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
lvm2-libs-2.02.169-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
lvm2-cluster-2.02.169-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
device-mapper-1.02.138-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
device-mapper-libs-1.02.138-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
device-mapper-event-1.02.138-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
device-mapper-event-libs-1.02.138-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017
device-mapper-persistent-data-0.7.0-0.1.rc6.el7    BUILT: Mon Mar 27 17:15:46 CEST 2017
cmirror-2.02.169-3.el7    BUILT: Wed Mar 29 16:17:46 CEST 2017

Comment 4 errata-xmlrpc 2017-08-01 21:49:49 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-2017:2222


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