Message ID | 20221109020917.4121067-1-jaegeuk@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp91179wru; Tue, 8 Nov 2022 18:11:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM4F2jKFx/itAjc4gGOCAPgfeKXSCMbDf+0w/lv0LGjON1Nn9NGFHccustW/AT2c0+X5hOOC X-Received: by 2002:a17:906:8a7c:b0:7ad:ad3a:b206 with SMTP id hy28-20020a1709068a7c00b007adad3ab206mr54670748ejc.345.1667959887373; Tue, 08 Nov 2022 18:11:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667959887; cv=none; d=google.com; s=arc-20160816; b=P3Rw1xZJPTdRIh5zU5Eyy3KLOzMmMbbrTEkjhtFu2oUvN3QKwK9ZqVSUQL1jhr2ng4 rp4U0Pv4KqbwYpaQ/0TFAYYEE0s29CZawIqoern6+gKBV/Siiz1AqR2a+dpROXAmuaQm IB+XucCL2+bylcTKDN4KSA5bH++/YFO/doG+wgdXExshmKSMDg1M3esK//y5S6OHssi2 fsv3lexoLJHf/yDr9KHeCnmH3tn9GaL8/8OY80mLgyabwpdD2u6TWEBfH7U2mB/jwaUQ OIw2ArFNW5yLeLWk3e2R+yao3tXxQCOeHxRVjaU3R/M3Mu0SmIyGL6YvXKYfus0rDPp2 +j4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=CPW61gTPsv5cTK2Rt9pFwr9nAryg+WUSR8h4GOH/oCk=; b=C4hAxvUfXENA8rEhUdnICx7pZdbOVUgojDXB9zhpxi2eOYm8EteJWWv7hufeg5p0+f DQvyPDE5oxYEizPo1q53CypzM2W9/l5HyIn3sDomCbQDa0yuR2drCIX6f+o9k1cR8TKu QsavOJ6VCkPYz7MWjBtsE1ynZ69TFT+Qyihccrgvw3XBoUA4E08AG6+Ew3nFWam3eDhP pLa0T5RSi6cpDep3d2rKcn9tPfExrqYls5BzM2/wGYqcONbPTIEA+UmbeqgiVQA22YzW p+a9Duq5JwUo+sGOQPn78pw/XGEcBbocfknrA+TodzDCHjBRyUSUEAfMo+kTfFidrShj 5pmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e0R6UZj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a170906431700b0078fcfc5d24esi10597092ejm.618.2022.11.08.18.11.03; Tue, 08 Nov 2022 18:11:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e0R6UZj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229818AbiKICJZ (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 8 Nov 2022 21:09:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiKICJW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 21:09:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 149F55D698 for <linux-kernel@vger.kernel.org>; Tue, 8 Nov 2022 18:09:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC269B81CF2 for <linux-kernel@vger.kernel.org>; Wed, 9 Nov 2022 02:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 633B8C433C1; Wed, 9 Nov 2022 02:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667959759; bh=GX1WjxW5uIqLEw8Wf86wBcBw2yon78ZixjUQkvdfwEM=; h=From:To:Cc:Subject:Date:From; b=e0R6UZj9AmzXm6wp3136fx0o1LvJiv/VAof9ELNn8s6q2CbXVQStgxEMGcgNykFDz rszEN5NztQnopREbtuR1A17yGS4s3zVWn9zi9Z0qYKGbpsvoHUEFcyJGl01NXi55OF xkZVnE3bMo2mdmkvBvCz7hXCPPC8MOygywIkvzihalQzAq1jVzsVoMV5qG1mie1cE/ PNu9mkCtWzDke1b98p4ddWi1ZuuCXJGLlsOinA65momdq6iDJPAbTKxDiQVQ/BCKgK pCXwle+mh97lr0xssPc3+vtM2SxDoq1bHeA/zWAGr7jDXiXpZW6JRCvtUZmGJEVPYZ lonJyYW+8db6A== From: Jaegeuk Kim <jaegeuk@kernel.org> To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim <jaegeuk@kernel.org> Subject: [PATCH] f2fs: allow to read node block after shutdown Date: Tue, 8 Nov 2022 18:09:17 -0800 Message-Id: <20221109020917.4121067-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748982706869748275?= X-GMAIL-MSGID: =?utf-8?q?1748982706869748275?= |
Series |
f2fs: allow to read node block after shutdown
|
|
Commit Message
Jaegeuk Kim
Nov. 9, 2022, 2:09 a.m. UTC
If block address is still alive, we should give a valid node block even after
shutdown. Otherwise, we can see zero data when reading out a file.
Fixes: 83a3bfdb5a8 ("f2fs: indicate shutdown f2fs to allow unmount successfully")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/node.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
If block address is still alive, we should give a valid node block even after
shutdown. Otherwise, we can see zero data when reading out a file.
Cc: stable@vger.kernel.org
Fixes: 83a3bfdb5a8 ("f2fs: indicate shutdown f2fs to allow unmount successfully")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
- Cc: stable
fs/f2fs/node.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 983572f23896..b9ee5a1176a0 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1360,8 +1360,7 @@ static int read_node_page(struct page *page, blk_opf_t op_flags)
return err;
/* NEW_ADDR can be seen, after cp_error drops some dirty node pages */
- if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR) ||
- is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN)) {
+ if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR)) {
ClearPageUptodate(page);
return -ENOENT;
}
On 2022/11/9 10:11, Jaegeuk Kim wrote: > If block address is still alive, we should give a valid node block even after > shutdown. Otherwise, we can see zero data when reading out a file. > > Cc: stable@vger.kernel.org > Fixes: 83a3bfdb5a8 ("f2fs: indicate shutdown f2fs to allow unmount successfully") > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 983572f23896..b9ee5a1176a0 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1360,8 +1360,7 @@ static int read_node_page(struct page *page, blk_opf_t op_flags) return err; /* NEW_ADDR can be seen, after cp_error drops some dirty node pages */ - if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR) || - is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN)) { + if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR)) { ClearPageUptodate(page); return -ENOENT; }