]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
NFS: Use an appropriate work queue for direct-write completion
authorNeilBrown <neilb@suse.com>
Tue, 7 Aug 2018 23:20:02 +0000 (09:20 +1000)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 8 Aug 2018 21:07:38 +0000 (17:07 -0400)
When a direct-write completes, a work_struct is schedule to handle
the completion.
When NFS is being used for swap, the direct write might be a swap-out,
so memory allocation can block until the write completes.
The work queue currently used is not WQ_MEM_RECLAIM, so tasks
can block waiting for memory - this leads to deadlock.

So use nfsiod_workqueue instead.  This will always have a running
thread, and work items should never block waiting for memory.

Signed-off-by: Neil Brown <neilb@suse.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/direct.c

index 621c517b325c664a81a609483ab7b9830f12e25a..aa12c3063baec60bad7483004379c2edd7800f5e 100644 (file)
@@ -758,7 +758,7 @@ static void nfs_direct_write_schedule_work(struct work_struct *work)
 
 static void nfs_direct_write_complete(struct nfs_direct_req *dreq)
 {
-       schedule_work(&dreq->work); /* Calls nfs_direct_write_schedule_work */
+       queue_work(nfsiod_workqueue, &dreq->work); /* Calls nfs_direct_write_schedule_work */
 }
 
 static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)