Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6285776iob; Tue, 10 May 2022 14:56:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBAAGHkHsDDA6M6C+Bp5gDAxiy4CzBuMZfe/LarzWTukMC8fQrLoWbzZEv0c5UcddXOBQ0 X-Received: by 2002:a05:6402:289a:b0:425:d682:105d with SMTP id eg26-20020a056402289a00b00425d682105dmr25976550edb.175.1652219803613; Tue, 10 May 2022 14:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652219803; cv=none; d=google.com; s=arc-20160816; b=kEfVdFh3ABnbZDRWjBo2xAGRIlmuT4mUUSDgfpsGNOJIZ5mEfqXmN9nezXAX13fxKA p8jycTEhUW9Y51af9mMngQKWpmKvAFOewcYAnIxV7oOzSo4Pi+UTT5mkQ2Csnt2i+UnZ ehPj/8C7as7Zreb+53L9gZxVk5Kq4eZj/KfRkBvcRK5cgmGQlff2KnOywulu1m3c6BTn WjecDTJK4zeDVD8AYJAb8mxBAbvipTKLyQRhtDIblzUotTQFDRgQh2t+/1rSMm7OR5V3 /w9/n4VgBX4K7ipjkFACwT0l1Xh3VgqZF+vh2q8alyLj9vNFJAPo+Oy8al5DUWhzwQH7 635Q== 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=4PR/qzvuPQ8TA4dgGfW2wilTreT/gL44pS2YZrkEcpw=; b=YwTGl4NZ8hjZDcQkHwnsWyTCHmz+bbx6KzZTXuSkkWhwLr9QOJkzGVhdGE6oNlADd7 R0ypDWZl7RQERj8ORuNoTJqfxl+Pmdy7YVpAaynPQyQ3jeckjmh2QkbAwu3urDXjLBQk VIkn3LbzCDd8TTcWe4odN+jdbl9ybpOswz9pKKSACFgCBkdpRwTkB68aWHkXokQT6yrW PRwYj/fXxuwrYEjPaRIIiSnrSAaMFwZi0i6XFDnnxxoLzPaz57kecycrN+01WOn4cGTe vC8meXLo3SQDH+WANexUkV7nbpW16uAkJYQEF2jqJrYYcq50wmtwkMb7s+yXltlDV/yM mgiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DNGDx7EP; 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 hp18-20020a1709073e1200b006f43b684908si860097ejc.31.2022.05.10.14.56.19; Tue, 10 May 2022 14:56:43 -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=DNGDx7EP; 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 S1343854AbiEJOHQ (ORCPT + 99 others); Tue, 10 May 2022 10:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243531AbiEJNoB (ORCPT ); Tue, 10 May 2022 09:44:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6D050B19; Tue, 10 May 2022 06:31:11 -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 sin.source.kernel.org (Postfix) with ESMTPS id 2B2B5CE1EED; Tue, 10 May 2022 13:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A771C385C6; Tue, 10 May 2022 13:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189467; bh=sxLapHNWEjM9BKEqFmfX+dQbnR8JAXuElA7Mx+lx8Jg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNGDx7EPUP9Zr6Lo8xndNRqYG6z7FjIFnaA4wDPtCHSCOtaWyq/f6Q2BJRZTC4qO3 aJchJRYiKT3VhDqw/FCNLwx3mpDZWFCX4j1QdGgLxUBCnXkdFQSqy7Wv1HwCMRQteH UJIzYlbcqOL5tZsQXwYxhpi+vMuJizIKbBBzWZeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.15 060/135] NFSv4: Dont invalidate inode attributes on delegation return Date: Tue, 10 May 2022 15:07:22 +0200 Message-Id: <20220510130742.129662082@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130740.392653815@linuxfoundation.org> References: <20220510130740.392653815@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 @@ -366,6 +366,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) @@ -6558,7 +6566,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);