hulk inclusion category: bugfix bugzilla: https://gitcode.com/openeuler/kernel/issues/8332 ------------------ This reverts commit 96780ca55e3cbf4f150fd5a833a61492c9947b5b. Under the following scenario, using NFSv4.1 may lead to deadlock caused by circular waiting. The scenario is: - NFSv4.1 client running heavy multi-threaded buffered I/O (fio-style workload) - server outage (restart/power-off) and/or network blackhole - client under significant memory pressure / reclaim activity (observed in the traces below) The observed behavior is a deadlock cycle involving: - v4.1 session slot table “draining” (NFS4_SLOT_TBL_DRAINING) - state manager thread creation via kthread_run() - kthreadd entering direct reclaim and getting stuck in NFS commit/writeback paths - non-privileged RPC tasks sleeping on slot table waitq due to draining This issue has already been discussed within the upstream. Before a formal fix is developed, it is suggested to revert back the patch that introduced the problem to prevent it from occurring.[1] In addition, this revert patch conflicts with 98ab188dbab3 ("[Backport] NFS: fix nfs release_folio() to not deadlock via kcompactd writeback"); please be aware of this when performing subsequent rollbacks. Link: https://lore.kernel.org/all/20251230071744.9762-1-wangzhaolong@huaweicloud.c... [1] Fixes: 96780ca55e3c ("NFS: fix up nfs_release_folio() to try to release the page") Signed-off-by: Wang Zhaolong <wangzhaolong@huaweicloud.com> --- fs/nfs/file.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 4994b2873970..0c4abe38b785 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -27,11 +27,10 @@ #include <linux/nfs_mount.h> #include <linux/mm.h> #include <linux/pagemap.h> #include <linux/gfp.h> #include <linux/swap.h> -#include <linux/compaction.h> #include <linux/uaccess.h> #include <linux/filelock.h> #include "delegation.h" @@ -447,17 +446,12 @@ static void nfs_invalidate_folio(struct folio *folio, size_t offset, 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)) { - if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL || - current_is_kswapd() || current_is_kcompactd()) - return false; - if (nfs_wb_folio(folio_file_mapping(folio)->host, folio) < 0) - return false; - } + if (folio_test_private(folio)) + return false; return nfs_fscache_release_folio(folio, gfp); } static void nfs_check_dirty_writeback(struct folio *folio, bool *dirty, bool *writeback) -- 2.34.3