NFS: Don't call generic_error_remove_page() while holding locks
authorTrond Myklebust <trondmy@gmail.com>
Sun, 7 Apr 2019 17:59:03 +0000 (13:59 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 25 Apr 2019 18:18:14 +0000 (14:18 -0400)
The NFS read code can trigger writeback while holding the page lock.
If an error then triggers a call to nfs_write_error_remove_page(),
we can deadlock.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/write.c

index 9198a23..64cf6a3 100644 (file)
@@ -584,9 +584,8 @@ release_request:
 
 static void nfs_write_error_remove_page(struct nfs_page *req)
 {
+       SetPageError(req->wb_page);
        nfs_end_page_writeback(req);
-       generic_error_remove_page(page_file_mapping(req->wb_page),
-                                 req->wb_page);
        nfs_release_request(req);
 }