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 A59EC42A15F for ; Mon, 6 Jul 2026 09:59:52 +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=1783331995; cv=none; b=LryfzkNMn+tuqhqDPvlgfqcBSvtBPX8W9jLnqjnZV2Jn7JjFy2rJE0iv0KIsoC5kv+UIvxzO6cFz6Sk1BEYCLjrKwd12zYmuaCPidUylDqZFitqwPo7itglbKiAGo1/3VIlOLHaPzJchVt42/ehVfmsAx3C0Hw1eppNHua5OaRw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783331995; c=relaxed/simple; bh=XKWuj9S+YOWH2ozkg2Cm7cf/5IrJVW6EvclIIZB4smI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I43TpsEqwWkC+bPV9Ae3AeNYZrEELl13735g39nMK06od94JYumlnw1N6naxL/03QurRvIn/+Jrn2otZ6ansRvRtc01/AaYAP2Gy4BrFjH8mVYZsMiI6NcSjqahKruQVe4XXg/PN0H0DD4SMS8idov1slW1gqh4A7MLQMb2sayU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o0672R1m; 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="o0672R1m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF5E51F00A3D; Mon, 6 Jul 2026 09:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783331992; bh=chjPuNCFQtUiE7OqGIJnm2ZFSRal0XTYbXylExYq4fo=; h=From:To:Cc:Subject:Date; b=o0672R1m+PN640PWaZ3WGV0QHFpLyyiLlYFGvglbB6O+fpJ0TBx+LXrXhsM/uW+zw o3ddwvf+OBYwG9cS00B9UThKtVN/gVxJTyimFG8+c4IIu3K+hwkEt4CsiLZiI3MxRJ uo15vLe0ZJ10Kk89PjEtPlPbAfWs9fxH6r+wWIjKQMyzd1t8JBuZmYPrYV2yY6AAcc HwSPTCKW0S9g71Um9H9lVX3GupRgZupQzRGdPGrCVWb61sU6N1vyxDpFTVPOdDCkV6 RlzN6CtUb4uEdkW2Zp5XMXjjYh5VSircD2ZYrTBkYZZuztptyfuXkBPoO1HLbqouj6 +4i/YdyHNbp0w== 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 1/2] f2fs: quota: do not use GFP_NOFS in f2fs_quota_read() Date: Mon, 6 Jul 2026 17:59:42 +0800 Message-ID: <20260706095943.2560208-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 drop it. Cc: Jan Kara Cc: Matthew Wilcox Signed-off-by: Chao Yu --- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index da468df058eb..fdfd6a7203dd 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3167,8 +3167,7 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, size_t offset; repeat: - folio = mapping_read_folio_gfp(mapping, off >> PAGE_SHIFT, - GFP_NOFS); + folio = mapping_read_folio_gfp(mapping, off >> PAGE_SHIFT, 0); if (IS_ERR(folio)) { if (PTR_ERR(folio) == -ENOMEM) { memalloc_retry_wait(GFP_NOFS); -- 2.49.0