]> git.proxmox.com Git - mirror_zfs.git/commit
Linux 5.13 compat: retry zvol_open() when contended
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 2 Dec 2021 00:07:12 +0000 (16:07 -0800)
committerGitHub <noreply@github.com>
Thu, 2 Dec 2021 00:07:12 +0000 (17:07 -0700)
commit77e2756de08ccd4e8ce755f78bdcda1e3e0c55e5
tree230b1de25c7af90496defdd1c5914f75223a8c38
parent31d2f42b2a55485b017f428b8f7c1836750ecde9
Linux 5.13 compat: retry zvol_open() when contended

Due to a possible lock inversion the zvol open call path on Linux
needs to be able to retry in the case where the spa_namespace_lock
cannot be acquired.

For Linux 5.12 an older kernel this was accomplished by returning
-ERESTARTSYS from zvol_open() to request that blkdev_get() drop
the bdev->bd_mutex lock, reaquire it, then call the open callback
again.  However, as of the 5.13 kernel this behavior was removed.

Therefore, for 5.12 and older kernels we preserved the existing
retry logic, but for 5.13 and newer kernels we retry internally in
zvol_open().  This should always succeed except in the case where
a pool's vdev are layed on zvols, in which case it may fail.  To
handle this case vdev_disk_open() has been updated to retry when
opening a device when -ERESTARTSYS is returned.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #12301
Closes #12759
config/kernel-blkdev.m4
module/os/linux/zfs/vdev_disk.c
module/os/linux/zfs/zvol_os.c
module/zfs/zvol.c
tests/test-runner/bin/zts-report.py.in