Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp957065ybf; Thu, 27 Feb 2020 02:40:29 -0800 (PST) X-Google-Smtp-Source: APXvYqygfgPtxKlEvvYVwlYx9INK50CsjNkaswq9W5lbIY3bbSxQG3grt1vxpkrWgEtmb0A7c61e X-Received: by 2002:a05:6830:1f0c:: with SMTP id u12mr2675590otg.253.1582800029258; Thu, 27 Feb 2020 02:40:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582800029; cv=none; d=google.com; s=arc-20160816; b=HEVc7t6Sn8BMhIgSdukaf8LDjS3mrQXrhGZd5J2Bqn2IYLeDO4MNyJFoRQaiq1Pn/x CEoz0NThdwoP5dDHzwAjc7Qj7UtsrqgLbhgvwCjRSScHvzN+85ex/JvYMIV0wxkiWXOO 718CcdkBUVg5mCrrK/VYphFWWqTIMsA115okEauYXelAObEGA2FRGR0WgS4izhl8Miul GiRXci5WXHsgMycdLshGEkjQglQrKD0ItYvUo+gqwnp4YqZLvsrqDO/F3yx/+jwsC46a CWbcs3S6kQGuCTQS+wHMlBY4y425mLcUjBDwDTczYRxfEForKzZJx76ANEz/X/3xVqvI ReKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=18e/D4/+MM+g0dJtKJ/+1YUnc9WxGhoPmwqIBBQ28ds=; b=RFK0R2uAV62Y6WgjYV6j9TOljUT6tvfbfxwZ7Tv+qdygVrJqgs1tIsQ3gWPiBmn9NU 1uONKqFGe/WeDBfwSXu4k9CwEDTUgbSfV2Wf1uzOs34xdwkWYb4HSbdI1RDgm26MIY3p 0bWAoI+MwFgQC9x3VVfNfeAVoy3rWFhddG9CA/q17MWHaFEsqbjEa3stmxyF1wU6t37D cK9SzJhMV1rl1CiV7g8NFaGTXNvnTyPRXT/M0g4Ej0MxBfEyBSLthlqdnzBQUblzEVbW FEtYsi2IFTgWGbzzVEWaHraq8e798PDWqD294/d8F0q6iz1uMoJLuvX3UiacccdAYTJ8 5NAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=UH4XKGPk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u143si813868oif.84.2020.02.27.02.40.17; Thu, 27 Feb 2020 02:40:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=UH4XKGPk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728856AbgB0KkI (ORCPT + 99 others); Thu, 27 Feb 2020 05:40:08 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:14618 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728729AbgB0KkH (ORCPT ); Thu, 27 Feb 2020 05:40:07 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1582800007; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=18e/D4/+MM+g0dJtKJ/+1YUnc9WxGhoPmwqIBBQ28ds=; b=UH4XKGPkC4idmSSRO02AFZYaKltda/HmOVxhlzHrrnO3QkjX81vGiASY3xs++LeQfp1egLv+ mxo5+aoi7PqsZ4O3oKAscANxZdFQqgLpsWoTn6o9uJuosx0lSgIyRCeLtVg1dTtefhP8ujuJ rk9LRgJ8sg287A0uNdumhO/L8co= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e579c7d.7fc534ba30d8-smtp-out-n03; Thu, 27 Feb 2020 10:39:57 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C869BC4479C; Thu, 27 Feb 2020 10:39:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: stummala) by smtp.codeaurora.org (Postfix) with ESMTPSA id E41B0C4479D; Thu, 27 Feb 2020 10:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E41B0C4479D Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=stummala@codeaurora.org From: Sahitya Tummala To: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Cc: Sahitya Tummala , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] f2fs: Add a new CP flag to help fsck fix resize SPO issues Date: Thu, 27 Feb 2020 16:09:38 +0530 Message-Id: <1582799978-22277-2-git-send-email-stummala@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1582799978-22277-1-git-send-email-stummala@codeaurora.org> References: <1582799978-22277-1-git-send-email-stummala@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add and set a new CP flag CP_RESIZEFS_FLAG during online resize FS to help fsck fix the metadata mismatch that may happen due to SPO during resize, where SB got updated but CP data couldn't be written yet. fsck errors - Info: CKPT version = 6ed7bccb Wrong user_block_count(2233856) [f2fs_do_mount:3365] Checkpoint is polluted Signed-off-by: Sahitya Tummala --- fs/f2fs/checkpoint.c | 8 ++++++-- include/linux/f2fs_fs.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index fdd7f3d..0bd4cdb 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1301,10 +1301,14 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) else __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); - if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || - is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) + if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) __set_ckpt_flags(ckpt, CP_FSCK_FLAG); + if (is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) + __set_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); + else + __clear_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); + if (is_sbi_flag_set(sbi, SBI_CP_DISABLED)) __set_ckpt_flags(ckpt, CP_DISABLED_FLAG); else diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index ac3f488..3c383dd 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h @@ -125,6 +125,7 @@ struct f2fs_super_block { /* * For checkpoint */ +#define CP_RESIZEFS_FLAG 0x00004000 #define CP_DISABLED_QUICK_FLAG 0x00002000 #define CP_DISABLED_FLAG 0x00001000 #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800 -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.