aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zvol.c
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2012-04-16 06:56:20 -0400
committerBrian Behlendorf <[email protected]>2012-04-30 11:25:36 -0700
commitce90208cf9e04df966429f115d8831371ea9afce (patch)
tree9c343a6f5181463626f6824f84f23785c7f8e408 /module/zfs/zvol.c
parent518b4876022eee58b14903da09b99c01b8caa754 (diff)
Disable direct reclaim on zvols
Previously, it was possible for the direct reclaim path to be invoked when a write to a zvol was made. When a zvol is used as a swap device, this often causes swap requests to depend on additional swap requests, which deadlocks. We address this by disabling the direct reclaim path on zvols. Signed-off-by: Brian Behlendorf <[email protected]> Closes #342
Diffstat (limited to 'module/zfs/zvol.c')
-rw-r--r--module/zfs/zvol.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index 9b1313402..9dd9547e2 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -1390,8 +1390,14 @@ zvol_init(void)
{
int error;
+ /*
+ * The zvol taskqs are created with TASKQ_NORECLAIM so they may be
+ * used safely as a swap device. If direct reclaim is allowed then
+ * they quickly deadlock in one of the internal memory allocations.
+ */
zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
- zvol_threads, INT_MAX, TASKQ_PREPOPULATE);
+ zvol_threads, INT_MAX,
+ TASKQ_PREPOPULATE | TASKQ_NORECLAIM);
if (zvol_taskq == NULL) {
printk(KERN_INFO "ZFS: taskq_create() failed\n");
return (-ENOMEM);