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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E29AC43458 for ; Mon, 6 Jul 2026 10:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:Date:To:Sender: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dCAfCcFtKibQnZLF7D7kIcYD4DzLbj/BYYDHj6+umuM=; b=lNXvAM1zSfGu68HwLwum8Y1V3J zM4IWmfSP8xBZBRI2DKJhGcmliRisKtraNKIdlz7zCvDxv1armnBBhpM9dsJgHXUL1k+WbMqRGv48 g7DXkOCfPaZu/L+/xhAOHlhJaGqwKcXjMYIljbQn9brN2gxA9KMahjEY8QCAwn4MvZlU=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wgg7R-0001TO-Rl; Mon, 06 Jul 2026 10:00:05 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wgg7Q-0001TG-BJ for linux-f2fs-devel@lists.sourceforge.net; Mon, 06 Jul 2026 10:00:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=chjPuNCFQtUiE7OqGIJnm2ZFSRal0XTYbXylExYq4fo=; b=i0YXbZX/xiaPSfQhCpCiU+gYL0 +wLD2IEvnd6q0stvtDLGBn9zb59xcPqaza5hp5LNrxmeevEhQSfyRSEdjWSyGYQcBMShePNJXryEg VPrEoj0J5i2JlrHm46nX180ZVYvYPp4GXMlj4cIYKd4aWtYVJSC5ikJfP3uY8IYjLBxI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=chjPuNCFQtUiE7OqGIJnm2ZFSRal0XTYbXylExYq4fo=; b=M sxTaeN+bfGY69cO1DH5s1wL5f2Dcar0b15eOOlpZrQpIGVd8tIDDHh+JF0XyBRq21lJJkAVIjuk6R 9lyzdC2RDtBpcnswTBrX/yty2iYTRYvrsqWuOhy8C0r+xntHW73JhWPIp+hpLzBdgVnWgAx350DUL 0jupsX0LRf6Hsp9k=; Received: from sea.source.kernel.org ([172.234.252.31]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wgg7O-0005cc-1g for linux-f2fs-devel@lists.sourceforge.net; Mon, 06 Jul 2026 10:00:04 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 38D0040A39; Mon, 6 Jul 2026 09:59:52 +0000 (UTC) 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== To: jaegeuk@kernel.org 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 MIME-Version: 1.0 X-Headers-End: 1wgg7O-0005cc-1g Subject: [f2fs-dev] [PATCH 1/2] f2fs: quota: do not use GFP_NOFS in f2fs_quota_read() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: Jan Kara , linux-kernel@vger.kernel.org, Matthew Wilcox , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel