Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2184653rwa; Mon, 22 Aug 2022 03:48:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR7IGRia9xaiYzHvcXVacK92Cn1vpipCgPKXwnG0N7FJpTXPe7EPmjnqwvJOQHC3Gu1E9/3R X-Received: by 2002:a05:6402:e98:b0:441:a982:45bc with SMTP id h24-20020a0564020e9800b00441a98245bcmr15398831eda.239.1661165319473; Mon, 22 Aug 2022 03:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661165319; cv=none; d=google.com; s=arc-20160816; b=U4Vfkhp7vCVxVUbU10yq0dEcumMDU9IZEKi22LxA/TNuHRVqWCuuT9eKn6G8kb+386 F7jTPKAmWwM4gSFiQl/9GyzhYGXTvZLbKhsdXOFHcHc0m2bLuHR+ggUazNoOVuu2BF5x dwWqzZz8rjHBKZrOXW10j6cXwBnyap3D3FmPxpBuV/dHRYcOAFuKb6u0SN1vaDTzpcZG bv4T/usRg32IE/1n9Kwjue17jC9Dsa0XeM2IOpsC6dUr3LuyoUoWfcxr44Az/AmvlZEv YK4p/bD6jt1g4C8VhVtNvLA8kqvSVZvTeI1QlMxa9KWw3smAn0WJps5MxTwnzZHhp72e drcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=q7psA9Dvu710si00DJeHJBtvznmL5MbYyqO9lWOmDaY=; b=q5+6VXhwCswUynuO4itZLe8Fx93DCzJkjv7cp785KrDnS8qsNo70G2aJFvyX49AEB2 Y7nzKKqr0tyJ51r0NazmbxY+LyF3rO65VMSjf9I1eMmBvE6cS//e1dd1A/kqLOLG6vTq rs3qQ0u9JVIaHlIOS0aE2B5h1eYVT94QJo3fptvmy7kWc+Xk3SJjkA8+ubNCeWwmwYCk G3lkeOLIgZDNRe7CpIZ/J2MXibppZrObY4kTKSV9RIRdTIZbEjtRHbuE2q863TLih+G1 iHKds9Oe6RX25mBj8T7AQyAryjJmsIBZHB2JEwTpwnGzHdFhDABGF69QkhOL9iS4zeiY Ba1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Toyz5EJm; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a170906974500b00734bc147380si10288145ejy.52.2022.08.22.03.48.03; Mon, 22 Aug 2022 03:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=Toyz5EJm; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 S233024AbiHVKkj (ORCPT + 99 others); Mon, 22 Aug 2022 06:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233192AbiHVKkW (ORCPT ); Mon, 22 Aug 2022 06:40:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C6F72E6BF; Mon, 22 Aug 2022 03:40:21 -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 14623B81032; Mon, 22 Aug 2022 10:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEAC5C433C1; Mon, 22 Aug 2022 10:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661164818; bh=yHtb/QXG0SOmjXqK03h8WGKXY6avHJktJO7EkQ7DU58=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Toyz5EJmLbKH9iqh3AVKjQo69eVx7aTUhE3XlgRi4yhf9+oF5/dyfUHE3rp9OmV+Y Lv0TIoTGQ2/gAW/kNQOsLZ0g3HbgYCucp1TI6p7wGbXcEm0PDauzX/fdpxEf+pfzjZ neR+XO2Uo5sN1nLVrEr+Mt1mBkJ44CsB8M+LblwcZKWsFlLbHkqmcZyT6iL5pNMv9u h9bnSbXo3bLZ6zAJY5rRo+cWbfGS4M+v+GDzUgpqyHXTguDCD+lWxiD64Ldxdfey/1 tUg2YOfv4blj+J8elmnmoarawbSFRDZb6Qtn1U/Iu9Xld7AFeB6yulZG/PzoPo5tGb Ng4Eul0Ewcftw== Message-ID: Subject: Re: [PATCH] xfs: don't bump the i_version on an atime update in xfs_vn_update_time From: Jeff Layton To: NeilBrown Cc: "Darrick J . Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-integrity@vger.kernel.org, Dave Chinner , Trond Myklebust , David Wysochanski Date: Mon, 22 Aug 2022 06:40:16 -0400 In-Reply-To: <166112626820.23264.11718948914253988812@noble.neil.brown.name> References: <20220819113450.11885-1-jlayton@kernel.org> <166112626820.23264.11718948914253988812@noble.neil.brown.name> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 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-nfs@vger.kernel.org On Mon, 2022-08-22 at 09:57 +1000, NeilBrown wrote: > On Fri, 19 Aug 2022, Jeff Layton wrote: > > xfs will update the i_version when updating only the atime value, which > > is not desirable for any of the current consumers of i_version. Doing s= o > > leads to unnecessary cache invalidations on NFS and extra measurement > > activity in IMA. > >=20 > > Add a new XFS_ILOG_NOIVER flag, and use that to indicate that the > > transaction should not update the i_version. Set that value in > > xfs_vn_update_time if we're only updating the atime. > >=20 > > Cc: Dave Chinner > > Cc: NeilBrown > > Cc: Trond Myklebust > > Cc: David Wysochanski > > Signed-off-by: Jeff Layton > > --- > > fs/xfs/libxfs/xfs_log_format.h | 2 +- > > fs/xfs/libxfs/xfs_trans_inode.c | 2 +- > > fs/xfs/xfs_iops.c | 10 +++++++--- > > 3 files changed, 9 insertions(+), 5 deletions(-) > >=20 > > diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_for= mat.h > > index b351b9dc6561..866a4c5cf70c 100644 > > --- a/fs/xfs/libxfs/xfs_log_format.h > > +++ b/fs/xfs/libxfs/xfs_log_format.h > > @@ -323,7 +323,7 @@ struct xfs_inode_log_format_32 { > > #define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */ > > #define XFS_ILOG_DOWNER 0x200 /* change the data fork owner on replay = */ > > #define XFS_ILOG_AOWNER 0x400 /* change the attr fork owner on replay = */ > > - > > +#define XFS_ILOG_NOIVER 0x800 /* don't bump i_version */ > > =20 > > /* > > * The timestamps are dirty, but not necessarily anything else in the = inode > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_= inode.c > > index 8b5547073379..ffe6d296e7f9 100644 > > --- a/fs/xfs/libxfs/xfs_trans_inode.c > > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > > @@ -126,7 +126,7 @@ xfs_trans_log_inode( > > * unconditionally. > > */ > > if (!test_and_set_bit(XFS_LI_DIRTY, &iip->ili_item.li_flags)) { > > - if (IS_I_VERSION(inode) && > > + if (!(flags & XFS_ILOG_NOIVER) && IS_I_VERSION(inode) && > > inode_maybe_inc_iversion(inode, flags & XFS_ILOG_CORE)) > > iversion_flags =3D XFS_ILOG_CORE; > > } > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > > index 45518b8c613c..54db85a43dfb 100644 > > --- a/fs/xfs/xfs_iops.c > > +++ b/fs/xfs/xfs_iops.c > > @@ -1021,7 +1021,7 @@ xfs_vn_update_time( > > { > > struct xfs_inode *ip =3D XFS_I(inode); > > struct xfs_mount *mp =3D ip->i_mount; > > - int log_flags =3D XFS_ILOG_TIMESTAMP; > > + int log_flags =3D XFS_ILOG_TIMESTAMP|XFS_ILOG_NOIVER; > > struct xfs_trans *tp; > > int error; > > =20 > > @@ -1041,10 +1041,14 @@ xfs_vn_update_time( > > return error; > > =20 > > xfs_ilock(ip, XFS_ILOCK_EXCL); > > - if (flags & S_CTIME) > > + if (flags & S_CTIME) { > > inode->i_ctime =3D *now; > > - if (flags & S_MTIME) > > + log_flags &=3D ~XFS_ILOG_NOIVER; > > + } > > + if (flags & S_MTIME) { > > inode->i_mtime =3D *now; > > + log_flags &=3D ~XFS_ILOG_NOIVER; > > + } > > if (flags & S_ATIME) > > inode->i_atime =3D *now; >=20 > I think you should also clear XFS_ILOG_NOIVER is S_VERSION is set, but > otherwise this looks sane to me. >=20 > Thanks, > NeilBrown Good point. I'll spin up a v2. Thanks, --=20 Jeff Layton