Skip to content

Commit

Permalink
Disable direct reclaim on zvols
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Closes openzfs#342
  • Loading branch information
ryao authored and behlendorf committed Apr 30, 2012
1 parent 518b487 commit ce90208
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce90208

Please sign in to comment.