]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zfs_ioctl.c
Add mutex_enter_interruptible() for interruptible sleeping IOCTLs
authorThomas Bertschinger <101425190+bertschinger@users.noreply.github.com>
Thu, 26 Oct 2023 16:17:40 +0000 (10:17 -0600)
committerGitHub <noreply@github.com>
Thu, 26 Oct 2023 16:17:40 +0000 (09:17 -0700)
commit97a0b5be50964d5ec288e85c853039fdee75c76b
tree31b0436db6fa576b1d37bbe3c4359878b7311364
parent6a629f32344468ae81b264055916641480cb438d
Add mutex_enter_interruptible() for interruptible sleeping IOCTLs

Many long-running ZFS ioctls lock the spa_namespace_lock, forcing
concurrent ioctls to sleep for the mutex. Previously, the only
option is to call mutex_enter() which sleeps uninterruptibly. This
is a usability issue for sysadmins, for example, if the admin runs
`zpool status` while a slow `zpool import` is ongoing, the admin's
shell will be locked in uninterruptible sleep for a long time.

This patch resolves this admin usability issue by introducing
mutex_enter_interruptible() which sleeps interruptibly while waiting
to acquire a lock. It is implemented for both Linux and FreeBSD.

The ZFS_IOC_POOL_CONFIGS ioctl, used by `zpool status`, is changed to
use this new macro so that the command can be interrupted if it is
issued during a concurrent `zpool import` (or other long-running
operation).

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Thomas Bertschinger <bertschinger@lanl.gov>
Closes #15360
include/os/freebsd/spl/sys/mutex.h
include/os/linux/spl/sys/mutex.h
include/sys/spa.h
include/sys/zfs_context.h
lib/libzpool/kernel.c
module/zfs/spa_config.c
module/zfs/zfs_ioctl.c