Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076908ybp; Thu, 10 Oct 2019 01:46:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw562+45KgKTUJPdJbg7UdEknKy+wvJ5g1pObM3wne4MpyOlqkV7cRvExpjfYE95FzjxSLp X-Received: by 2002:a05:6402:6c9:: with SMTP id n9mr6806272edy.190.1570697179407; Thu, 10 Oct 2019 01:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697179; cv=none; d=google.com; s=arc-20160816; b=hpLqtdGZ8oxtB6QvV6vucUdmGQ1FrWPgLMVkyooz3qzANBq3UM+iNlK5r3Aw+es0IV mfi5N6RtVI0HJ1iGk/SMYPM8XFMTjchAZqEvgc3HpxXjQMmY+LeMt9Qj2bmLDuNrpQPX HCfFjm5YBFs4Vj9IcXo1+bwct8Jg5bc+9teqGLUKGoM6lKceq7w6U6Q0nXaJOvS1KTIK H5alFfXxe08j9dw4RS1w9htDLJqUj9YKKbUD8iPXSeq7Lezt3kK+bh1ZMNMFAUrbH7U/ 1PEW8GB416MRK6OGe3d4Ep7xsuoeeMCEzBZjrWcC2ZKDbopAqdPFzodRKO2F0MPKBJ1U Lo0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OqX9P2uYmZOt4WCLzqXZe1oeLJtd+ZMjWN7vzMIG08g=; b=KZRPO6HuGC7e+pMiBbTs154M30kFKDXiqVbNoJoySrZ5LMDSQUnkqF7NmiPCWVd23e BQTlnUIdd976LNvoABRjo6F8DX3onlzTXKQQUiXgv/NhsLS9KwvC2NdvLwnWDXl+20xY ityFZ3txmzoqFyCDoKDF9gHWJAGxJInJMl9BOTfn2MQnRs3K5+Dkd/Q9ZVrTCO0DDL0r gXs+3D3BmviTar25vtBVQjctO8VK0aR9QdTShVG+TN0DdzDRxoUu/ikEumf7ANFMtHJH +8vipcJeR2L0E2FxMjb0G9PQpy6YSW+WdOOZB5/ekDcpmIYRF5tyAH2LOnbRh00XTkHX YxqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sFpj4IeO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si2716494eje.336.2019.10.10.01.45.56; Thu, 10 Oct 2019 01:46:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sFpj4IeO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388520AbfJJImS (ORCPT + 99 others); Thu, 10 Oct 2019 04:42:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388511AbfJJImR (ORCPT ); Thu, 10 Oct 2019 04:42:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D71621BE5; Thu, 10 Oct 2019 08:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696936; bh=sYY95Hr5Vx7uYLpkaAUKFT7rsKYr+ZKBrBYfbzCeno0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sFpj4IeO7dW0YE87fjvz349bwSlJOgFFtXL3eGZpHJWtvdyUhuycbgCaSlp+SEUNV m+h5zUhzORPEkkkHHM5/RAjgL502a8ZTsqrPq3bM8iMW1K6XTNjl/5skfs/E/FwIf2 C8elT/R/HY7B/urcL44YUdQDE3sS3XfOOubhLP5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.3 107/148] pNFS: Ensure we do clear the return-on-close layout stateid on fatal errors Date: Thu, 10 Oct 2019 10:36:08 +0200 Message-Id: <20191010083617.658814199@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit 9c47b18cf722184f32148784189fca945a7d0561 ] IF the server rejected our layout return with a state error such as NFS4ERR_BAD_STATEID, or even a stale inode error, then we do want to clear out all the remaining layout segments and mark that stateid as invalid. Fixes: 1c5bd76d17cca ("pNFS: Enable layoutreturn operation for...") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- 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 4525d5acae386..0418b198edd3e 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1449,10 +1449,15 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args, const nfs4_stateid *res_stateid = NULL; struct nfs4_xdr_opaque_data *ld_private = args->ld_private; - if (ret == 0) { - arg_stateid = &args->stateid; + switch (ret) { + case -NFS4ERR_NOMATCHING_LAYOUT: + break; + case 0: if (res->lrs_present) res_stateid = &res->stateid; + /* Fallthrough */ + default: + arg_stateid = &args->stateid; } pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range, res_stateid); -- 2.20.1