Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6067639iob; Tue, 10 May 2022 09:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnkeYXKFlLBFuHgF9ommsG2IUCMhlUXeaBHRzDCcl4J8eoirG1SqLRWTHd4i8JSPhRHoJN X-Received: by 2002:a17:907:1c25:b0:6f4:2d46:52ce with SMTP id nc37-20020a1709071c2500b006f42d4652cemr20407702ejc.25.1652200549894; Tue, 10 May 2022 09:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652200549; cv=none; d=google.com; s=arc-20160816; b=eOn59ZeGRDfK7zArQD7HydCZ77mQCzuAFR3qdwL+p4jYgjkZIhryZi9uWCPEJzYxCn Rkcm9pPEopjaFE9eqSQuUJMYPuHFj43hvwnMoCSfQk4I8Z/Fh1Jz4miKQSvQeHcijnFg Iaz/vwVw151xefbpB3/eNUMe1/B5MUuBABZ/hMzygoGCEmRJH/e8wjfYfO66+NhzML9c OxzW5UTlcYMTVfslP8Z40O5w1wtmfyNDq0dM1/gvKhrwEmfiaITSAB/wA2l2zGVhvz8Z 3a0NU64kn2tRTNvkUPcEcXe8GHEpvHn8v2WsmIvQ0/KKxQc+6QmNYNE+R20djjDWOne3 yyXA== 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=TnSaNDRgSofyt5ROZUVNYQo97ASFgH8GKFZPKA6Ilg4=; b=XOzZwoJnFgRYHvoSNX6J2BxpZFve0E81N2ugewFKyCrhb9PMyjOeL3zobQgpH4dTIZ YWMFlklrldCiZL8VtRQeMxlINcarSMv+sDjMaAuERjkqbVAm2J6UtUy7AaIuXc58uwDo Y5KLcNb4xd4brJBcEwJrVjefsB29WuqFJIrh2u7mqVucRH/MqIz1TC6ze98pnC7rKgGq 01IbRDEIinECiAoRKa3YKazKDyaj9rO15S3KVxgDysIBoVmhoicI/0Lyd3X227JF74vV EqMPndDQcyvi9Tniq+F3v1DBogfUqIqaSZbtae+fRj0X7ASC4jwzN9cEBrjS8W/5fwg8 OVPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gld/VLoW"; 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 ho15-20020a1709070e8f00b006fa15acc456si10254168ejc.931.2022.05.10.09.35.26; Tue, 10 May 2022 09:35:49 -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="gld/VLoW"; 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 S244660AbiEJN4J (ORCPT + 99 others); Tue, 10 May 2022 09:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244927AbiEJNiQ (ORCPT ); Tue, 10 May 2022 09:38:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D20B1737B1; Tue, 10 May 2022 06:26:40 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 08D4F6170D; Tue, 10 May 2022 13:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AA80C385CB; Tue, 10 May 2022 13:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189199; bh=D8r2jFoTEUVlsyCv66uIxzQz4KMltHDjNuYGVD5H6EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gld/VLoWvEY26mu/aoeFOsiyl4oTLHHRN4/zwHm1H6N2dTP93fCMavxUq6s0fcKPy vw2NXWkUv+x2TuO+oqr10es0AY5cc9owj4mjjy58nwJuIBBllZ4dBt/Qq1Y3sovNi8 H94O1C+4qWaoqGJ7QUC0DNbUlXIfnSfIteHMgBCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.10 44/70] NFSv4: Dont invalidate inode attributes on delegation return Date: Tue, 10 May 2022 15:08:03 +0200 Message-Id: <20220510130734.150568877@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@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.7 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,URIBL_BLOCKED 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: Trond Myklebust commit 00c94ebec5925593c0377b941289224469e72ac7 upstream. There is no need to declare attributes such as the ctime, mtime and block size invalid when we're just returning a delegation, so it is inappropriate to call nfs_post_op_update_inode_force_wcc(). Instead, just call nfs_refresh_inode() after faking up the change attribute. We know that the GETATTR op occurs before the DELEGRETURN, so we are safe when doing this. Fixes: 0bc2c9b4dca9 ("NFSv4: Don't discard the attributes returned by asynchronous DELEGRETURN") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -369,6 +369,14 @@ static void nfs4_setup_readdir(u64 cooki kunmap_atomic(start); } +static void nfs4_fattr_set_prechange(struct nfs_fattr *fattr, u64 version) +{ + if (!(fattr->valid & NFS_ATTR_FATTR_PRECHANGE)) { + fattr->pre_change_attr = version; + fattr->valid |= NFS_ATTR_FATTR_PRECHANGE; + } +} + static void nfs4_test_and_free_stateid(struct nfs_server *server, nfs4_stateid *stateid, const struct cred *cred) @@ -6464,7 +6472,9 @@ static void nfs4_delegreturn_release(voi pnfs_roc_release(&data->lr.arg, &data->lr.res, data->res.lr_ret); if (inode) { - nfs_post_op_update_inode_force_wcc(inode, &data->fattr); + nfs4_fattr_set_prechange(&data->fattr, + inode_peek_iversion_raw(inode)); + nfs_refresh_inode(inode, &data->fattr); nfs_iput_and_deactive(inode); } kfree(calldata);