diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-01-19 16:33:48 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2023-02-14 14:22:33 -0500 |
commit | 96780ca55e3cbf4f150fd5a833a61492c9947b5b (patch) | |
tree | 2b3f114b7e4296e6fa568efab2f939c54101e007 /fs/nfs/file.c | |
parent | 70e9db69f927bb378db9aaa807cc83ae550779a9 (diff) | |
download | lwn-96780ca55e3cbf4f150fd5a833a61492c9947b5b.tar.gz lwn-96780ca55e3cbf4f150fd5a833a61492c9947b5b.zip |
NFS: fix up nfs_release_folio() to try to release the page
If the gfp context allows it, and we're not kswapd, then try to write
out the folio that has private data.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 563c5e0c55e8..3bed75c5250b 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -432,8 +432,13 @@ static bool nfs_release_folio(struct folio *folio, gfp_t gfp) dfprintk(PAGECACHE, "NFS: release_folio(%p)\n", folio); /* If the private flag is set, then the folio is not freeable */ - if (folio_test_private(folio)) - return false; + if (folio_test_private(folio)) { + if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL || + current_is_kswapd()) + return false; + if (nfs_wb_folio(folio_file_mapping(folio)->host, folio) < 0) + return false; + } return nfs_fscache_release_folio(folio, gfp); } |