From patchwork Thu Aug 20 09:18:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58AC2C433E1 for ; Thu, 20 Aug 2020 13:53:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BAE2206DA for ; Thu, 20 Aug 2020 13:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597931635; bh=kNgCBFBfSxz7ugVSsubOOTo6lfh4ohoZlx1eQ7qlYBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2rkjk8+Tc9LLqt3CeXt/vXMsliWIFmBPX2KXy+DcjMpOW4g3CKFtXZ3s3r7AFrgJg m6qPVy7YjGKOMdE/FJRQYluLqxjs/NxXZGxl9jT/CEvRhBz57srOdd50nE7E1ble1m sNRlsFJRXLLZUNBUnxJpsX3N4tbMk0dXIaUEqycg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729601AbgHTNxq (ORCPT ); Thu, 20 Aug 2020 09:53:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:33466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbgHTJZJ (ORCPT ); Thu, 20 Aug 2020 05:25:09 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A91822CF6; Thu, 20 Aug 2020 09:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915508; bh=kNgCBFBfSxz7ugVSsubOOTo6lfh4ohoZlx1eQ7qlYBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9fGYYNjwmjnGTY7df4M3URxXX6UbpaCYWMcVuKR0hwHuTlK3ZOuFPUglK66hie8k j66eFbe5REQ0pAmyLmapApju9LcGN8ErX8tKgbGOsoVFq5HXom2jk6kO4GRLvaeNyq jg+QQ1y4ySG2H54RCC1cK+QbCEcJJ1xPJdZg3PW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Sandeen , Josef Bacik , David Sterba Subject: [PATCH 5.8 039/232] btrfs: make sure SB_I_VERSION doesnt get unset by remount Date: Thu, 20 Aug 2020 11:18:10 +0200 Message-Id: <20200820091614.669649341@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Josef Bacik commit faa008899a4db21a2df99833cb4ff6fa67009a20 upstream. There's some inconsistency around SB_I_VERSION handling with mount and remount. Since we don't really want it to be off ever just work around this by making sure we don't get the flag cleared on remount. There's a tiny cpu cost of setting the bit, otherwise all changes to i_version also change some of the times (ctime/mtime) so the inode needs to be synced. We wouldn't save anything by disabling it. Reported-by: Eric Sandeen CC: stable@vger.kernel.org # 5.4+ Signed-off-by: Josef Bacik Reviewed-by: David Sterba [ add perf impact analysis ] Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/super.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1897,6 +1897,12 @@ static int btrfs_remount(struct super_bl set_bit(BTRFS_FS_OPEN, &fs_info->flags); } out: + /* + * We need to set SB_I_VERSION here otherwise it'll get cleared by VFS, + * since the absence of the flag means it can be toggled off by remount. + */ + *flags |= SB_I_VERSION; + wake_up_process(fs_info->transaction_kthread); btrfs_remount_cleanup(fs_info, old_opts); return 0;