From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E0532FF641 for ; Tue, 7 Jul 2026 11:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783424386; cv=none; b=HppebhzwDMsOUfnMrw6OVW76pQxLl2hlcIwsb2h9mCsZHMf+TfCvpm80TC0VjOwK9Gok1v4aGiAsIGwgWJQgcgjvAMeVT9kvUFXJn3xYdDsigUegCXdJnTRi6aKbpeB3YACisDxUuBWwYV2EwlECMn91b7prMcA47IrcTF9Eehk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783424386; c=relaxed/simple; bh=fDga0ycs6Avqt9F9G+h2ORORWKgYSWIS3XDlAFKVEk0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Cl9aDvl9VhSEtUq3n0maC761O5vi3VAJI9SHUq6MSmjVo5CyvCnT6QaSgj0eGF65VSM/8TJSMcnSo+V9pzhLo8EhhpM5KLNQ+fdRTtCceV97F5UCrD6GEC/s8U83g2gEJ5ZB1U62JfOdQdQSw+lrGqk695/jCJpNdUahXDwfXx8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ull28zYr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ull28zYr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9144B1F000E9; Tue, 7 Jul 2026 11:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783424384; bh=8hv6ECuVxgmg/zj45Tp0KIT0r8U/VUnKGooGk8kRCb8=; h=From:To:Cc:Subject:Date; b=Ull28zYrWWnV+VmDkdFti2SgXmWMV3Ny1lLQLrhqN0RgT50WeLJ1jVh/VAXvtD5I/ C8cZSJslEOkxpx2F/xr7I1OpgUGPpNZWqK6mgDIyq7D+EMUz5+dP2WuhJiQ7h07xr0 dwMIwr7xS4jtEhLdjBvlWHL+MaEig2mQEJFbLCpPcj+57GKuE0GF8FUUj7if7jNN4b cMmzNGql+IbKvFlsQIhSmJqtM/xrsTD8z6cDX8p57PjR+55/EKKeBIltTq6ENIG35/ ti19bqrQU9mViZxsAUg6D0RDFY/rp1pinH4aFK185PIqk3Rr5QoLA0vqdJFt6TzEd0 dR1uJ5Q4GmoOA== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , Jan Kara , Matthew Wilcox Subject: [PATCH v2 1/2] f2fs: quota: do not use GFP_NOFS in f2fs_quota_read() Date: Tue, 7 Jul 2026 19:39:33 +0800 Message-ID: <20260707113934.3003158-1-chao@kernel.org> X-Mailer: git-send-email 2.55.0.rc2.803.g1fd1e6609c-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 02117b8ae9c0 ("f2fs: Set GF_NOFS in read_cache_page_gfp while doing f2fs_quota_read") adds GFP_NOFS in f2fs_quota_read() to avoid below deadlock: - do_sys_open - vfs_open - dquot_file_open - dquot_initialize - dqget - dquot_acquire : locks &dqopt->dqio_mutex (VFS Quota Mutex) - qtree_read_dquot - f2fs_quota_read - read_mapping_page (GFP_KERNEL / allows GFP_FS) - __alloc_pages_nodemask - try_to_free_pages (Direct Reclaim) - prune_icache_sb - evict - f2fs_evict_inode - dquot_drop - dqput - dquot_commit : tries to lock &dqopt->dqio_mutex again ==> DEADLOCK (waiting for itself) As Jan Kara mentioned, quota system has fixed this issue w/ commit 537e11cdc7a6 ("quota: Prevent memory allocation recursion while holding dq_lock"), so this GFP_NOFS flag should be relic, let's use GFP_KERNEL instead. Cc: Jan Kara Cc: Matthew Wilcox Signed-off-by: Chao Yu --- v2: - fix to use GFP_KERNEL instead of 0. fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index da468df058eb..b1725ca68010 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3168,7 +3168,7 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, repeat: folio = mapping_read_folio_gfp(mapping, off >> PAGE_SHIFT, - GFP_NOFS); + GFP_KERNEL); if (IS_ERR(folio)) { if (PTR_ERR(folio) == -ENOMEM) { memalloc_retry_wait(GFP_NOFS); -- 2.49.0