Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp400860pxb; Wed, 1 Sep 2021 01:12:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeLCZZBWhPggG3zEB5GYj5qYIzlM5KiAsmtH+/+6YcfpXDpkpt9FADmVJI7+GKuh8lUSkr X-Received: by 2002:a17:906:58c7:: with SMTP id e7mr35131900ejs.197.1630483920380; Wed, 01 Sep 2021 01:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630483920; cv=none; d=google.com; s=arc-20160816; b=tTr7mFjHFQbVmrgnY70k+FP9KPZTEABz4k93ytav79y00fVbeQt66VljX0ofF55Sb+ PSPht3muHlDC8BeC0wuhl7s/w1mf+hru/Tugp9P3vS/CelbS5eHIId5POoLyX33nRzSq N8JhH2HixcGmbnNetJsEphkTsm8fbXXlttQq+qeFcnBXucJZ7Xsgbrd0phykp+cnk9BW szlZiheRL8tHLNU3xqld9lFaLqd5UTB/Z9UN7fjktsJUbAqoF33ZqpMd3RL629cGXeag UdkpV/B9K/E7jK51Bo9/vm1esFySsBeZMjNdGOaLphX7R4nQX34VqnVumgzAYlboBU4t Smaw== 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=Pblvpa1XiHJljoQs8KOWJQEidfESGx7IO3ScQM/D3sw=; b=EcyDrbOabUfwYNKIjYdzONbjvbPX56t7S1Ru4abGp3VJkhISkqkQB7sPk1iFStIPbs STT1hiKuyMwpfpjCRbvXzSh1rxOeLubznXzStER0P7yrtQoHpDO0JuynhVpt9DHNQQNd Ct+bNiMHiyGCgutDI8zwV/7SnVtoYlGOZYylODt72ad/wzUSyymsg/2qtgaFYEComw8m GaL4dfivWttwjMXQkdc7LocOFhyoX8s/i3qWR//3Zu7wF8CjwBN/dFQZdaoP+0u/OlLM EqBn4ED9vYZsFOvL1pSHTsp+t8ZXvAfeVQ+KRBfVpLR4ZnCE+65+cSFYTHu1UHkG23fP c6fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PrGxvohd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw8si1760355edb.355.2021.09.01.01.10.58; Wed, 01 Sep 2021 01:12:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PrGxvohd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242910AbhIAIHl (ORCPT + 99 others); Wed, 1 Sep 2021 04:07:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:51962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242909AbhIAIH0 (ORCPT ); Wed, 1 Sep 2021 04:07:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C5C06103D; Wed, 1 Sep 2021 08:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630483589; bh=HFXW2CXUVuj9t9Ig1elcp8R+lAYqA68TQyV8IJQJvmA=; h=From:To:Cc:Subject:Date:From; b=PrGxvohdSMKpxmdJwW5SPfczCcjE5fL6gAUWGavIuNT7hu0PyUfwKybImG0WvaXn2 z6nig86cxvCyPjpfz5yZUO20j9538S1kNeoDCyH/GkInabkNG0+Xz4WFvbgCUj+M23 rlhVNBwclhRUhpt1ReCG9oiLeAClaia2Vp8yZ2RCgxmFi4kIGLfZkNO62TylLX0dFC Z03oFieXanxlH0WK1lRf5yvL/FvgayU4z2FOeY9BEgM8YKhHRMk0MgZnq1eFv8EHZm 65B5ZtdSWg+hyWNPERdua/0Q9JNMx5TZU6Ule3BpLYY+Sl2lh57XqawNLMw7GDofPr LOin7K0sJnF4A== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , Chao Yu , Zhang Yi , Jan Kara Subject: [PATCH v2] f2fs: avoid attaching SB_ACTIVE flag during mount Date: Wed, 1 Sep 2021 16:06:21 +0800 Message-Id: <20210901080621.110319-1-chao@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoted from [1] "I do remember that I've added this code back then because otherwise orphan cleanup was losing updates to quota files. But you're right that now I don't see how that could be happening and it would be nice if we could get rid of this hack" [1] https://lore.kernel.org/linux-ext4/99cce8ca-e4a0-7301-840f-2ace67c551f3@huawei.com/T/#m04990cfbc4f44592421736b504afcc346b2a7c00 Related fix in ext4 by commit 72ffb49a7b62 ("ext4: do not set SB_ACTIVE in ext4_orphan_cleanup()"). f2fs has the same hack implementation in - f2fs_recover_orphan_inodes() - f2fs_recover_fsync_data() Let's get rid of this hack as well in f2fs. Cc: Zhang Yi Cc: Jan Kara Acked-by: Jan Kara Signed-off-by: Chao Yu --- v2: - don't bother checkpoint disabling path fs/f2fs/checkpoint.c | 3 --- fs/f2fs/recovery.c | 8 ++------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 83e9bc0f91ff..7d8803a4cbc2 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -705,9 +705,6 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi) } #ifdef CONFIG_QUOTA - /* Needed for iput() to work correctly and not trash data */ - sbi->sb->s_flags |= SB_ACTIVE; - /* * Turn on quotas which were not enabled for read-only mounts if * filesystem has quota feature, so that they are updated correctly. diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 04655511d7f5..706ddb3c95c0 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -787,8 +787,6 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) } #ifdef CONFIG_QUOTA - /* Needed for iput() to work correctly and not trash data */ - sbi->sb->s_flags |= SB_ACTIVE; /* Turn on quotas so that they are updated correctly */ quota_enabled = f2fs_enable_quota_files(sbi, s_flags & SB_RDONLY); #endif @@ -816,10 +814,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) err = recover_data(sbi, &inode_list, &tmp_inode_list, &dir_list); if (!err) f2fs_bug_on(sbi, !list_empty(&inode_list)); - else { - /* restore s_flags to let iput() trash data */ - sbi->sb->s_flags = s_flags; - } + else + f2fs_bug_on(sbi, sbi->sb->s_flags & SB_ACTIVE); skip: fix_curseg_write_pointer = !check_only || list_empty(&inode_list); -- 2.32.0