Skip to content

Commit 96780ca

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
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>
1 parent 70e9db6 commit 96780ca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/nfs/file.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,13 @@ static bool nfs_release_folio(struct folio *folio, gfp_t gfp)
432432
dfprintk(PAGECACHE, "NFS: release_folio(%p)\n", folio);
433433

434434
/* If the private flag is set, then the folio is not freeable */
435-
if (folio_test_private(folio))
436-
return false;
435+
if (folio_test_private(folio)) {
436+
if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL ||
437+
current_is_kswapd())
438+
return false;
439+
if (nfs_wb_folio(folio_file_mapping(folio)->host, folio) < 0)
440+
return false;
441+
}
437442
return nfs_fscache_release_folio(folio, gfp);
438443
}
439444

0 commit comments

Comments
 (0)