Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2724123pxb; Sun, 24 Jan 2021 18:26:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzwl0rRuxR9BHTc0LxuUuCdcxKK/xSwt9TQdTKlo+sNBY26tRhzzHtB3eSpceqjXeDw9bA X-Received: by 2002:aa7:cd62:: with SMTP id ca2mr1945156edb.81.1611541592072; Sun, 24 Jan 2021 18:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611541592; cv=none; d=google.com; s=arc-20160816; b=xFYRk8yhoelAvL5L5XqCNuibrRA5YW1h43S+KE7zqU6M48jrY6VKZSt0uQR0bhl5g+ vxv43FLBpOelKOTtagLk37uLu9kkfRi9qiUqUc6X6Ld05JrRC4XwUNGLZsWkTqO2mnxU pxJQbx4VYhBrxqT0IMw15bVBZjt/5Y30BFJ9Tyu71+HaAguTt7oKEy627IIaxbtis6/W CA/yRXj8DH06mgdrmNl+HxGzyQRxNF0a6h3mqJ7cl6ROFjDPd+mKb1PIJWeMM4pmlZlp G7zgOl+wCpWyMtpANMU6xYFBmqmwYlLI+dLNADjoH4rAuGRUzNrCnNFciqhuamrXDeN0 q50A== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CvJVcqUGRjtryuwKwElF25KTJUfMNDy0ipGbGGEeuVw=; b=uvWAQcXV58kVNzr9M3VqUChCZ6pFocWDAI1y9tNPYucbTho7s+EU6SUcSnguLpU4k/ RJrW5yK7pyaGG9Gd4aQUGQpcWWxnHrvTt7fSElSJzfv+DDJlPiacfOn9pp0VaJtw7DNu qwaJJ7Eg5fqiXg3bScxhpxgWhEpgDUJE553SeMdnyOtTIm7YS43yij/EqFBLjGqQDjEY +SuNMfp0r3mDUeRZEfJngMokiDOMmLLBM6mauS1IR1zpMYIdE9/gkjmo61uPGZ130uvO orP2CGledjWgvuBzY0WOTfktNBC6TAsO3yKrn6F/FQVQGI1DghlW+8YxpcyKz7MeoxMR CjSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XgZlYRoQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si5590561eju.191.2021.01.24.18.26.09; Sun, 24 Jan 2021 18:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XgZlYRoQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 S1726863AbhAYCXr (ORCPT + 99 others); Sun, 24 Jan 2021 21:23:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:42400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbhAYBzY (ORCPT ); Sun, 24 Jan 2021 20:55:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14560207B6 for ; Mon, 25 Jan 2021 01:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611539678; bh=cBWvWPlPvNudHQcW0ZkEDfh/yrXqrX6wOhwUPt3k7wg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XgZlYRoQLAps3lfsCNDCpLSRhtgkOLVjctAi2pyoGjlrbJNQGcXKyY9KuuG4VDvnM juxKFjOcOR4TuaBbNG4v4sCyLh8Pih8mbgyLu3nonY+f4NOqw9sT8us5BHJ71K9B+t 9P++xMLpYRWXIvEl8oUpVnewPLLvRry1eKEqpYEMxM5u+Bi3imkgIeATypa3v9bIwq uqznJUtrSqOzW0Iu2M8MmfhLjlFcpYbOsq/yOQIN0DDLREUgI76JPFKA4PychZ6XLD bAmC3jcuv/HRRcSB3D6gOrg+BeNewgtRdJusCCTuQZxrL6GdgNEk4+6aEfAXa9hV9C XTGNRd0J1FFMQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 2/4] pNFS/NFSv4: Try to return invalid layout in pnfs_layout_process() Date: Sun, 24 Jan 2021 20:54:33 -0500 Message-Id: <20210125015435.45979-2-trondmy@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125015435.45979-1-trondmy@kernel.org> References: <20210125015435.45979-1-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust 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 --- fs/nfs/pnfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index e68e6f8cb407..d6262289cf4a 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2398,7 +2398,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; } @@ -2417,7 +2423,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) spin_unlock(&ino->i_lock); lseg->pls_layout = lo; NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); - pnfs_free_lseg_list(&free_me); return ERR_PTR(-EAGAIN); } -- 2.29.2