Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 919696

Summary: sys-fs/zfs-2.2.2: init script "zfs-import" doesn't implement stop() and can't properly deactivate zpool during shutdown
Product: Gentoo Linux Reporter: ev
Component: Current packagesAssignee: Sam James <sam>
Status: UNCONFIRMED ---    
Severity: normal CC: gentoo, jstein, neb.semqen.ramesses, sam
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=647688
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: patch adding stop() to /etc/init.d/zfs-import

Description ev 2023-12-10 22:38:53 UTC
Created attachment 878653 [details, diff]
patch adding stop() to /etc/init.d/zfs-import

ZFS zfs-import doesn't have stop() functionality and cannot properly unmount zpool (zfs export -a).

This causes a lot of error if zfs pool is on dmcrypt encrypted devices.
Zfs still holds block devices because pool is imported and dmcrypt cannot close them. 

Example
 *   crypt15 ...
device-mapper: remove ioctl on crypt15  failed: Device or resource busy
device-mapper: remove ioctl on crypt15  failed: Device or resource busy
device-mapper: remove ioctl on crypt15  failed: Device or resource busy
...
device-mapper: remove ioctl on crypt15  failed: Device or resource busy
device-mapper: remove ioctl on crypt15  failed: Device or resource busy
Device crypt15 is still in use.
 [ !! ]


Dmcrypt errors significantly prolong shutdowns and reboots if system has a lot of encrypted drives.

I'm attaching a patch which adds zfs-import stop() and I'll try to send it upstream.

You may consider disabling ZPOOL_EXPORT='yes' by default just like ZFS_UNMOUNT to avoid hitting bug https://bugs.gentoo.org/647688. 
(My patch has this option enabled to be consistent with upstream code)