Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp667278iog; Thu, 30 Jun 2022 08:01:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1snIXEsMyfMRzF3gbtfnVNt9wrs8nQfzCuER/F7yahqTTTY38njdpC+/ju75jiqHZQKlxWE X-Received: by 2002:a05:6a00:1690:b0:517:cc9e:3e2d with SMTP id k16-20020a056a00169000b00517cc9e3e2dmr15159243pfc.0.1656601301268; Thu, 30 Jun 2022 08:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656601301; cv=none; d=google.com; s=arc-20160816; b=vZZHhNqqUyG+ZOmH0IO8084B+TxROUWk7ulzK8BMXtEwRtLuL0jmNPUlF68ok67CDl Cm4UREG7GN58GGnhwjejGNsK5h7mku2vjrn6MMdejxnOsbv/PZS+9CHnXZFC3/JQX0KJ h0Mp9CtQBttqoGqkRxU++FvzsHdzKY/xKdUYIIa/ny6QscrX6eIid6qPA9TX4BLseIY5 SpyyMIr91JvFP9zQ6gxX9bBQ1Gzvla4+rzF6MmyN2Vogmxui77yQY0++fTy33X/31/C1 d71F6NyWdhmlODhKozel0DoP/KQEZ/qf0CNKUKnvL0GDgakxpYlZYvMB+l/SKU86YQrM M64w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HaU0QdXT2p2LHOtNce2vrnYlfhQlrARm0UtKUUke7u4=; b=U8ldUPS0WjlzHHHuG4kFJUfnN5Ep3sh9J43KuvR35hhMH76aRlf/e8HqymGezFKwEa uaV9RyXig28wn1Ma32YavOy9xPg85f3SSvTXEeZJpB6YIyuFjQLbVJqGLn/uu2Q/lJD7 sx9IZZvKbrXAWP59y6OesO5QbbMTGxnrwRmwZ0G99xg95xVkxAe6irz+jM7q6LfK5kgP B60dGqbw5rm0W4pPIfZChf4jcWiVcPz18r9SqtWZjcm1W3w9QLCEYi5FyUN448DccRQp dWltqASg2mczHK58ICfEsc/ueuxntAsEnfyvjeYutW7lcFNoGTWIiMeXPkOVsTJ51lTt AFDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=elGYcWqZ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a655a05000000b0040242f36212si27476790pgs.287.2022.06.30.08.01.22; Thu, 30 Jun 2022 08:01:41 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=elGYcWqZ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236733AbiF3OJB (ORCPT + 99 others); Thu, 30 Jun 2022 10:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236881AbiF3OHo (ORCPT ); Thu, 30 Jun 2022 10:07:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3411151B2B; Thu, 30 Jun 2022 06:54:48 -0700 (PDT) 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 BCF60B82AEE; Thu, 30 Jun 2022 13:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E82C34115; Thu, 30 Jun 2022 13:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597273; bh=4v0fsfLUzjjscr7KR1qh/Hzx2Fsnw09iUftGXOjqJQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elGYcWqZLs8wwKFrv3xf+KL/x4o3Uj1t8/+sIaYwXgGghBw5FuezR3daXZOjpzV9e XYaTfC9laGPTybKDvOoW+oFa3+xVC2bUXXkxrFLU0Bw2pshAi8TmGNUsMvM9S+RLab wS/fMh21/VLGtDhceDyORUJqpSHUIYGruwgviYEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "Darrick J. Wong" , Dave Chinner , Leah Rumancik Subject: [PATCH 5.15 11/28] xfs: only bother with sync_filesystem during readonly remount Date: Thu, 30 Jun 2022 15:47:07 +0200 Message-Id: <20220630133233.259618088@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133232.926711493@linuxfoundation.org> References: <20220630133232.926711493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 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,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" [ Upstream commit b97cca3ba9098522e5a1c3388764ead42640c1a5 ] In commit 02b9984d6408, we pushed a sync_filesystem() call from the VFS into xfs_fs_remount. The only time that we ever need to push dirty file data or metadata to disk for a remount is if we're remounting the filesystem read only, so this really could be moved to xfs_remount_ro. Once we've moved the call site, actually check the return value from sync_filesystem. Fixes: 02b9984d6408 ("fs: push sync_filesystem() down to the file system's remount_fs()") Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1773,6 +1773,11 @@ xfs_remount_ro( }; int error; + /* Flush all the dirty data to disk. */ + error = sync_filesystem(mp->m_super); + if (error) + return error; + /* * Cancel background eofb scanning so it cannot race with the final * log force+buftarg wait and deadlock the remount. @@ -1851,8 +1856,6 @@ xfs_fs_reconfigure( if (error) return error; - sync_filesystem(mp->m_super); - /* inode32 -> inode64 */ if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { mp->m_features &= ~XFS_FEAT_SMALL_INUMS;