From patchwork Thu Nov 21 08:26:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 13881754 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 7B96CD75BD1 for ; Thu, 21 Nov 2024 08:28:23 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tE2Y1-0000IW-NZ; Thu, 21 Nov 2024 08:28:22 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tE2Y0-0000Hq-AI for linux-f2fs-devel@lists.sourceforge.net; Thu, 21 Nov 2024 08:28:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=71E4341NbUzaGbo8d4OwKtWSrpfxXyAdlYjaKjSuvg4=; b=QrHKW+NQLbEb76EwMbVompji/g B+SU93Rh2c+M8w71dTBp08ECeSY54o2mSdk1KmNOfWjGPY8acGsSSp3QOl4JXNHC5LcVGZmB1RT4M IkcuctyLHYCY4X69JlHlXvXLXOITblCiSjBjFw5yj+btJfkAU8yFxF99v1cG5mw3MbxQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=71E4341NbUzaGbo8d4OwKtWSrpfxXyAdlYjaKjSuvg4=; b=YOx7NKClcLxPAVS+cAv5LM8vx1 hu/VxktlmUHKj5rPR0y1qXjzCt12TLCZvGMftTdtLAAEbW9Cfe+4lF3m/XZPVuPNYAJ5WTNbAsklo qGB8H+5tJ9AG3U5TbXuECsLS7cxmU6b+DMsP1si/LAVWBNgYoXxG8zOV6gaghwkG8KwA=; Received: from mail-eastasiaazon11010049.outbound.protection.outlook.com ([52.101.128.49] helo=HK2PR02CU002.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tE2Xz-0002QN-Io for linux-f2fs-devel@lists.sourceforge.net; Thu, 21 Nov 2024 08:28:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R+CorMpfRGNXvnQ92/VEan1sFk+JktUa3joZ4vLQVml9C5ufDrzjMenL36lvi4FBLk5Z8p0ZewYG3zrGkP1OyjCXrP1N92qMmpD7/Gd+z1obT4ofUBBdPq4KJhUNEaEmWniD+0ktgT1fZaiDVu4CwWCFFM+tJUNY3bqtXc0EGJ+0NUt3A7aG0LUWcJcTNUV/tU77D4HaG3+Cem04oLbbnmEdFfbz0urzwFP0/Na4J06fR42iy38jXWoYz/GvwrlxghvUV1oEhs8+YBil8DuvdQ/74NsMSfBCiXYSqBnhUsOGq9s8euKD9GiS7qlFd6t8q2FLEXETuTbN8D1c/1QqyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=71E4341NbUzaGbo8d4OwKtWSrpfxXyAdlYjaKjSuvg4=; b=GNJoKofPG4hZ2I/LDcYL6bSRJd2nj9kpWqNs+hsLNJDwpAQV9sEt4Qy09DW764Lj09frQ32uI5YLUq563Epj1SbG727MhHwJZeK1PtfJvXDYfF/vqXx57CCcZYvRmERqRDTs88z3bWNTM4s186NTbbpOCWfs1CEukp7bZdc9giepy5l3ZDQj/CdQnS9k5uCf4gaOo7uQ60MfTMwA0C5wLxHThDjDy7okRolLHNASrbMSojAoaWLHYvvJAXYSVtu9FgV+I8186qCqyuFhhbTZuTH2UuRICylHRK6uDHNsFmjSu9P5VAPojrlsiy9WGg659rVsUgB28s2/S6fe27wvfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=71E4341NbUzaGbo8d4OwKtWSrpfxXyAdlYjaKjSuvg4=; b=RHbQvUacW3oPBDJkyiEbpqmcht/+dKKnwJYmYebfJ1m9KyYznCvreVRUjxXdNLhR0s+h3SbXfZ6Ndv89lnnLRTttD9iUIc5CWRaC2UnHxgyaabiTL0kOEUWN+nP5oVD3KCBh8/GYzTD1df0bbX4D7UZjVHvRfcWOfxcC/31VDkM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) by TY0PR02MB6290.apcprd02.prod.outlook.com (2603:1096:400:265::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Thu, 21 Nov 2024 08:28:11 +0000 Received: from SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796]) by SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796%7]) with mapi id 15.20.8158.019; Thu, 21 Nov 2024 08:28:10 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Thu, 21 Nov 2024 16:26:56 +0800 Message-Id: <20241121082657.2644346-1-shengyong@oppo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <202411211538.Tus6kZm1-lkp@intel.com> References: <202411211538.Tus6kZm1-lkp@intel.com> X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR02MB6014:EE_|TY0PR02MB6290:EE_ X-MS-Office365-Filtering-Correlation-Id: 910da9b1-d3e6-49f3-fb8e-08dd0a066ed6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 3/p+9KhFQaVBhtg92IFMY0Tbzhqr4YeIMWwh4bR+kGq4Khee6a5oEJx+GqbgCLrdj88Jd792f8bMau0a0lLxhJOczrfeIU3yWPceTVUjr2iDoJJsARTodL4ixpHW9Sptg2PqLPsjCIwMWKySKEqyu5cQtvtYdJQA9y5tu9eaTs2BByzdeM4pAMF3PFYsl+ZZtB5H9jFCrMTZtNbkgENgSNSspQtwhcD6PqxivlevrQDMo5cpfGgN3lmW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TdOEwfOQr/555hgbcB6+7zde7uGNTsxOL0XXbC5b5CQy1cLOidr9EgQJTY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEYPR02MB6014.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 66fEEOkLRv2UyufzMY1JIxy0P5fmh7aYTMwB2YCKlf3ZMRtQ55rju2ADReQ5SAPQSAgpvysNM578PITyzTzhJHJZHWu4q01GRfzwQFik2ppViWHEZ50hpUp5IIGdFNiJfzf1u4t217OMkNBoT/R48vXyBNo8AknZznIUerwjkRzUT1SmTEmUrMUiWhdOZZNzS0Jx7wAdFQpy0QSX5EL+aJElJNKK7pkRU/sz/Wdy7EsWcBtksfGqFnrRQSBXBpKX+gRq2THmqOB6j/Ue8FWMTcD+QjsK1pYKCEZDRukpx7dZD5ITxHYRn9eLkgQAQtReK3zS/ec58XbNIqeT3Hk+HPevbPL2xZ/gE7otUEdGtUBnu5DQp6Ci10nWXoq1auku5zGwlJmHNA0zi4tQpeqmMqrGh1wibJfQNmcNm+1SxhWlajni63y2x4ARe2YO6Hgr1r/dimRU8Z/odbnw3/xCZIM9V6ZpVlD96BMv8AeWyEs0DMF5D/iSbRoxOgayjM/14Qa1Zw2+wQmh6q4y82s7Um00Xmd1YvZSYyj8Vb8jebDSEyNDl8/Ilhe/uXAAd6PV0cSPWv3IJS/UH08m9f5bioA19V++cbEo0moJcrgpMr8c/yWD1KCSrb5FtGYXqb0i7cKvofcN8fgDEsrQepkvjLViOi4xis24qNV/3hbmBkY+mGhsuM7p/M1o0+2zvw2pajTfQhHAxL801gn00EmNU1zLyVL2m7ONjccfdkB6DLG5Cn3qx5gZfw6ZocCNpVT/KmXaHteyHcG0C69stbm62984hu/UMCay1wO8KrIprfldjWGLqIhYzqccFS6563Ms0waFdEP6sR5da41ApgS36rZ1kLXvp1jklJzRtnb1AXY6wiHP/FkwTWzjeZEZNj2vF2ilTjF2WmvU1Vom1r4j6LPB0DPlkgVwEFb64L6EOi1h2GuMMV6+oNme7c68xjyEy1TaBW2WXM0VnFpdT/R5pjPXWT70VQyqMiid6KcTJoKTU8oqdKRO5nzHU6LNrzRKAK5wSJQDx8+wCUik+goDJ4dHJ7WHMrmpTO5wKeK6aXDaTJpsOY1Nkuroz+PELnrj1HByGjQnq268F7BC8ib8YXhiRZPFprbv2YrVZEnovm9bsyJqyTbf9dYvs1iQQe0nwh+49DJC5Wpei4D3FOS8f25uG4LMiBEc9dlv9Nmhp7EWJwKS3TRXUZAiOPde23Uhk6t7f0myoStjGJo1tzzO0LRyaj9qerrBoR7JR9ABP4pDT005PpblN0j9WXr/thzI5RyJf+Ipu1W0o8WX6ZGFX9AV07LWh6yoS6LiHiVPuLxbpWpcRL4C9ZU3jmdVUjuvmpDDDSkPzipLSWI1oJHNKZk96WXvT3IfN0uGf4uEy6dy8Icgz7uV/Y0xXFxw6SJJZuJz1EotIUXmedyywTsBwtA5V6r4M4j8Anm5j8wq5YA35h2F150cERvFSCDxgi8JmB7BeY3U+zAEbEegh1pvDEUlcYyPDYK9ZvDuxpNng5+fu9AzFp82qMcbBRiQRm3BjUYVb8abbPkLYykk5kALWevTpHYzoBEuLvPhVXVynZdXj5OCZZVA/P3sGMDDh1kM X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 910da9b1-d3e6-49f3-fb8e-08dd0a066ed6 X-MS-Exchange-CrossTenant-AuthSource: SEYPR02MB6014.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 08:28:10.4643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SiFhBzU2oyL+pQfRCoD2VKKZTysJgXfr0ByhFtiPaltaHc+5N4DmzkyooIg6dNBRdr67ItD5p+s3BDtYNuP+Uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR02MB6290 X-Headers-End: 1tE2Xz-0002QN-Io Subject: [f2fs-dev] [PATCH v3 1/2] f2fs: fix changing cursegs if recovery fails on zoned device 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: , X-Patchwork-Original-From: Sheng Yong via Linux-f2fs-devel From: Sheng Yong Reply-To: Sheng Yong Cc: linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Fsync data recovery attempts to check and fix write pointer consistency of cursegs and all other zones. If the write pointers of cursegs are unaligned, cursegs are changed to new sections. If recovery fails, zone write pointers are still checked and fixed, but the latest checkpoint cannot be written back. Additionally, retry- mount skips recovery and rolls back to reuse the old cursegs whose zones are already finished. This can lead to unaligned write later. This patch addresses the issue by leaving writer pointers untouched if recovery fails. When retry-mount is performed, cursegs and other zones are checked and fixed after skipping recovery. Signed-off-by: Song Feng Signed-off-by: Yongpeng Yang Signed-off-by: Sheng Yong Reviewed-by: Chao Yu --- v3: * fix compiling error when CONFIG_BLK_DEV_ZONED disabled v2: * add wrapper to contain f2fs_fix_curseg_write_pointer and f2fs_check_write_pointer * make f2fs_fix_curseg_write_pointer and f2fs_check_write_pointer static and remove their f2fs_ prefix --- fs/f2fs/f2fs.h | 3 +-- fs/f2fs/recovery.c | 9 ++------- fs/f2fs/segment.c | 29 +++++++++++++++++++---------- fs/f2fs/super.c | 15 ++++++--------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 119706dbaefa..b65b023a588a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3775,8 +3775,7 @@ void f2fs_write_node_summaries(struct f2fs_sb_info *sbi, block_t start_blk); int f2fs_lookup_journal_in_cursum(struct f2fs_journal *journal, int type, unsigned int val, int alloc); void f2fs_flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc); -int f2fs_fix_curseg_write_pointer(struct f2fs_sb_info *sbi); -int f2fs_check_write_pointer(struct f2fs_sb_info *sbi); +int f2fs_check_and_fix_write_pointer(struct f2fs_sb_info *sbi); int f2fs_build_segment_manager(struct f2fs_sb_info *sbi); void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi); int __init f2fs_create_segment_manager_caches(void); diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index e4d81b8705d1..f35be2c48e3c 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -899,13 +899,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) * and the f2fs is not read only, check and fix zoned block devices' * write pointer consistency. */ - if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sbi->sb)) { - int err2 = f2fs_fix_curseg_write_pointer(sbi); - - if (!err2) - err2 = f2fs_check_write_pointer(sbi); - if (err2) - err = err2; + if (!err) { + err = f2fs_check_and_fix_write_pointer(sbi); ret = err; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index edf2a74207b3..4236040e3994 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5246,7 +5246,7 @@ static int report_one_zone_cb(struct blk_zone *zone, unsigned int idx, return 0; } -static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type) +static int do_fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type) { struct curseg_info *cs = CURSEG_I(sbi, type); struct f2fs_dev_info *zbd; @@ -5351,12 +5351,12 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type) return 0; } -int f2fs_fix_curseg_write_pointer(struct f2fs_sb_info *sbi) +static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi) { int i, ret; for (i = 0; i < NR_PERSISTENT_LOG; i++) { - ret = fix_curseg_write_pointer(sbi, i); + ret = do_fix_curseg_write_pointer(sbi, i); if (ret) return ret; } @@ -5379,7 +5379,7 @@ static int check_zone_write_pointer_cb(struct blk_zone *zone, unsigned int idx, return check_zone_write_pointer(args->sbi, args->fdev, zone); } -int f2fs_check_write_pointer(struct f2fs_sb_info *sbi) +static int check_write_pointer(struct f2fs_sb_info *sbi) { int i, ret; struct check_zone_write_pointer_args args; @@ -5399,6 +5399,20 @@ int f2fs_check_write_pointer(struct f2fs_sb_info *sbi) return 0; } +int f2fs_check_and_fix_write_pointer(struct f2fs_sb_info *sbi) +{ + int ret; + + if (!f2fs_sb_has_blkzoned(sbi) || f2fs_readonly(sbi->sb)) + return 0; + + f2fs_notice(sbi, "Checking entire write pointers"); + ret = fix_curseg_write_pointer(sbi); + if (!ret) + ret = check_write_pointer(sbi); + return ret; +} + /* * Return the number of usable blocks in a segment. The number of blocks * returned is always equal to the number of blocks in a segment for @@ -5435,12 +5449,7 @@ static inline unsigned int f2fs_usable_zone_blks_in_seg( return BLKS_PER_SEG(sbi); } #else -int f2fs_fix_curseg_write_pointer(struct f2fs_sb_info *sbi) -{ - return 0; -} - -int f2fs_check_write_pointer(struct f2fs_sb_info *sbi) +int f2fs_check_and_fix_write_pointer(struct f2fs_sb_info *sbi) { return 0; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 35c4394e4fc6..0db3fb47ff6f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4766,16 +4766,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) reset_checkpoint: /* * If the f2fs is not readonly and fsync data recovery succeeds, - * check zoned block devices' write pointer consistency. + * write pointer consistency of cursegs and other zones are already + * checked and fixed during recovery. However, if recovery fails, + * write pointers are left untouched, and retry-mount should check + * them here. */ - if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sb)) { - int err2; - - f2fs_notice(sbi, "Checking entire write pointers"); - err2 = f2fs_check_write_pointer(sbi); - if (err2) - err = err2; - } + if (skip_recovery) + err = f2fs_check_and_fix_write_pointer(sbi); if (err) goto free_meta; From patchwork Thu Nov 21 08:26:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 13881753 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 78469D75BCD for ; Thu, 21 Nov 2024 08:28:23 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tE2Y3-0007WI-1W; Thu, 21 Nov 2024 08:28:23 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tE2Y2-0007W6-1T for linux-f2fs-devel@lists.sourceforge.net; Thu, 21 Nov 2024 08:28:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7hSDkaOgxDxj42wa6Xm3IDycZHGXFlzxMJ0NklK4+QQ=; b=BzbYwCoSojorxqwCBzXijQN3BB VFR90mWJIfRJwInJX0b1RIg7eubOK6tiwFfG+J1b6FzkD8hKAt7b9Ncs8SNi5UeklL1d+QoyxlmGX o5donEFtYDsOj7Kv2gTBZg5w3B/OvgjqmYSo/IdyA7sAIiQn12pdMXMsGfCZ3mJ/kd/s=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7hSDkaOgxDxj42wa6Xm3IDycZHGXFlzxMJ0NklK4+QQ=; b=PCgevgeOeSrENHmxACXHOo8WQH g/2ZY2TpPm7TF94aJZTlBB2EPBxBGyQRKrIdBDANY1Sykqp0nMsylcHnAZnWFTPbZouIwzN6HymkW 2dpp+416pXAAXPyqd4sZWfMrdl5IKB/qYzzu9prLbnHbqkGjxrSIS4r5qIEUiCJ49hQo=; Received: from mail-eastasiaazon11010049.outbound.protection.outlook.com ([52.101.128.49] helo=HK2PR02CU002.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tE2Y1-0002QN-EK for linux-f2fs-devel@lists.sourceforge.net; Thu, 21 Nov 2024 08:28:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MpRlbBvg8yt7rr4yb7SFaMGSW8Rtm0zSKN28hTlBaEvgoGE9tqUa5QMznSBu0Vimk5jS6XjICk4SS3o0UKHCYslFifZhhReknxX7+B5LQrwGsr51jkK5t5PGxnx2lULAqIqeJskz98gCDtA81yJdWGIkRjlzhmr68wPNwgLgxkHVLiOEyEVLE/ePLj1ofMujK0GWv3fCRbWa1GIyTZ9QB/1MMuhcwbHaX+B7rL55tlmieHM+oEyilD732P6qeEGWJalHt3XYONBFFtfrFf4rAE3xwppYZ6ngm4PfUF+SI4WQ5JxZCW0GSg5zXPWCC0faIp2pV9XMxaqozBnIGTWBjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7hSDkaOgxDxj42wa6Xm3IDycZHGXFlzxMJ0NklK4+QQ=; b=dnZKcuY2226tbO43PYoYFCpO9umqeJ/2QZpdjN+lr3SOs8OYRekec9MqDqGWfqSSwKRA0Lx7MqaUwjxNbkjP0anZB1vrSE14r/Dwug4k09Ml1DZQM3RYca6NI8f1xmrwWej6kNLyS7nCsFL95o+SYeq4MU0wxu+XIP79E8wl2dCzgPv6y9PNzW2QbImCG0zzE1omVLq6js93Trc7wjBRsKBHcrVNy+m9k+qGHQcsKUMHUCoOZDg7FHUZLeZHI+TxJOQGiS9nQV7gJw1oKlME7QqcTMRnMjafiIMsxDZLbZhAFJqDwCgUBZfdnh2ZRUpRw5qYGjWOZA5NPXVlc+j+NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7hSDkaOgxDxj42wa6Xm3IDycZHGXFlzxMJ0NklK4+QQ=; b=EVZP9+gY1zYUVVI3D1O7buWAS3C5hLrw7n37tNkQDh96BKLgszz/qxf2f54X6PSPCUdx7OIxeQTD5f/0s1Cd2HPPuXfIlHd9lGYi9+Mk8V4WF5ZRLl69fsSiGP5Jd+tiN1HGQcyaiuwOj8BkX3Z7hpFZc0HFOrBY0VDx2/t3iMA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) by TY0PR02MB6290.apcprd02.prod.outlook.com (2603:1096:400:265::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Thu, 21 Nov 2024 08:28:12 +0000 Received: from SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796]) by SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796%7]) with mapi id 15.20.8158.019; Thu, 21 Nov 2024 08:28:12 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Thu, 21 Nov 2024 16:26:57 +0800 Message-Id: <20241121082657.2644346-2-shengyong@oppo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241121082657.2644346-1-shengyong@oppo.com> References: <202411211538.Tus6kZm1-lkp@intel.com> <20241121082657.2644346-1-shengyong@oppo.com> X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR02MB6014:EE_|TY0PR02MB6290:EE_ X-MS-Office365-Filtering-Correlation-Id: ddc56e49-4b4d-4440-2b04-08dd0a067008 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: GPl0Clp2H1OgEW2VSqr/EZL1guyTZ9M09LJp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XlT4ZiSbcJ9KnKqGzsdWFyjGa5rsIywuEs4Y8pjrxFiIFTgR3CiHm4zJ5cTTAuNH7KGlO+GsPn0WGs3qfS+pp8qSxqr4PTdsRXYbz/QG8Vwt2O2tQQio+AR2L5DSa25pvbp3ubklTZYOKRDu8Vo2fKeBuHK/ZsMinbWROMKxvfnJaAMUdTkv56hau+zom3huINj3XQnU9Hj9ucNAgaC1mtidTra5nmMRIvTHZVbjL5Pi+4LU8qFE+1rsBLIhaJRFbx8lyYIFhgKlAFYu5bBP0tYQBK+hI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEYPR02MB6014.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cgrvYHyGssRztQQwyZL53HfLGVy3vLBoywbwg4CV1Pewj2oak8HPrY5QzFfai4Q53WngLmTOmfr7h5Yt4pEBpKpmu8kiMrjJBhU54KKKX2gwp7P42FaZhlc3gppa/Wn1uLTcL0Npi3KuMGAjW7CDeP0/HJ29/8jYrXXeIXaG1IZf0vFIuETGPJjrjAwY3jE3c2+aZnOXj2jyidT/nl5m0r1OPUsp6EjjwwZXTmtd6eZDW2YHuKjcu+Gmdu5rxjfo/SJdhsofBB3MgKf2Afd79M3bGf7pS5w3akbSN8MNkt5/WxK5taTiaNDgffdQM18YAjbyuZSBAbXLFKjmlnQTt7D5MVBfPfwZpRW6RPw3kyrVRaYGIp8dWE3JRLg0GwhiS0witCmjrWN5rmZB4hM8AdTaXlQxt9Ni2iAMtipBXEtaP4BExpES8jCBoWlKHWxUpL8HvEmI+/weXl80pLG5pgLjEFW55rRtzA108iXRV2uKrNMaGMJgSDeVZjvcs1dQfyAHponhPI2565joY1xsfXwG0Z8zvHgrv7T3DvifyNLUMG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Tenant-Network-Message-Id: ddc56e49-4b4d-4440-2b04-08dd0a067008 X-MS-Exchange-CrossTenant-AuthSource: SEYPR02MB6014.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 08:28:12.4585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2tq+3g0p2MSfCD0ew94yPKJI5qGvuCDs1PIF6S9PXDnIqBGdcqhe8KIe7w3XaD2pGEYbp4Y8RGgT+JKB3rt4Uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR02MB6290 X-Headers-End: 1tE2Y1-0002QN-EK Subject: [f2fs-dev] [PATCH v3 2/2] f2fs: clear SBI_POR_DOING before initing inmem curseg 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: , X-Patchwork-Original-From: Sheng Yong via Linux-f2fs-devel From: Sheng Yong Reply-To: Sheng Yong Cc: linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net SBI_POR_DOING can be cleared after recovery is completed, so that changes made before recovery can be persistent, and subsequent errors can be recorded into cp/sb. Signed-off-by: Song Feng Signed-off-by: Yongpeng Yang Signed-off-by: Sheng Yong Reviewed-by: Chao Yu --- fs/f2fs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 0db3fb47ff6f..9aab877f152f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4776,13 +4776,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) if (err) goto free_meta; + /* f2fs_recover_fsync_data() cleared this already */ + clear_sbi_flag(sbi, SBI_POR_DOING); + err = f2fs_init_inmem_curseg(sbi); if (err) goto sync_free_meta; - /* f2fs_recover_fsync_data() cleared this already */ - clear_sbi_flag(sbi, SBI_POR_DOING); - if (test_opt(sbi, DISABLE_CHECKPOINT)) { err = f2fs_disable_checkpoint(sbi); if (err)