From patchwork Mon Feb 22 12:35:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 386720 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 2BE42C433DB for ; Mon, 22 Feb 2021 12:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBB2764F2C for ; Mon, 22 Feb 2021 12:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbhBVMjf (ORCPT ); Mon, 22 Feb 2021 07:39:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:52816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbhBVMin (ORCPT ); Mon, 22 Feb 2021 07:38:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A59C864E2F; Mon, 22 Feb 2021 12:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613997473; bh=myC20GzG4yb86AWQuQJ/5AAA5IHzhNSyKhrgFITgzg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WD/lT2WtmS6E0YDjbC6Kw4uA2rvLMg1ciiW8eEGq4n1BZdUJhJ4INW4pGtH/68538 Xt5byzcC8MjqVWGqyC9oDDOm1w50xRom1w7G4+r+scDEfgVKDoDAiCXlFxjwDtB8CW Y86hGw0AmQBFEuQsD5hLRMeJeulgtRJCpeT0B5lA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 05/57] pNFS/NFSv4: Try to return invalid layout in pnfs_layout_process() Date: Mon, 22 Feb 2021 13:35:31 +0100 Message-Id: <20210222121027.593475883@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210222121027.174911182@linuxfoundation.org> References: <20210222121027.174911182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Trond Myklebust [ Upstream commit 08bd8dbe88825760e953759d7ec212903a026c75 ] If the server returns a new stateid that does not match the one in our cache, then try to return the one we hold instead of just invalidating it on the client side. This ensures that both client and server will agree that the stateid is invalid. Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/pnfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 8e2e3d3b7b253..0737f193fc532 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1973,7 +1973,13 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) * We got an entirely new state ID. Mark all segments for the * inode invalid, and retry the layoutget */ - pnfs_mark_layout_stateid_invalid(lo, &free_me); + struct pnfs_layout_range range = { + .iomode = IOMODE_ANY, + .length = NFS4_MAX_UINT64, + }; + pnfs_set_plh_return_info(lo, IOMODE_ANY, 0); + pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, + &range, 0); goto out_forget; }