From patchwork Mon Jan 18 11:34:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 366948 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,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 2B930C433DB for ; Mon, 18 Jan 2021 11:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E252622BEA for ; Mon, 18 Jan 2021 11:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390407AbhARLhr (ORCPT ); Mon, 18 Jan 2021 06:37:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:33392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390402AbhARLhp (ORCPT ); Mon, 18 Jan 2021 06:37:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 91E4122B40; Mon, 18 Jan 2021 11:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610969798; bh=9B7rvRIs0JR6WZeRet5IG/Mx2kwHcgbhxHbzGYhH1p0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C50L6bYiq4P26tjaiHms/uAlAA/gxzzePSYGICWsKUWMub1t2YhD1mwSSRnlQi1qa tAeKHANzVTqFpT9DY6DQCb9eIr+cjyjp5ON/c264FN2uY+dYWNZowLY3dii4tfrZ8d uVnqUlW4My+i8MiHvfgAy2R95uA0caZYMDYN/pZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.19 30/43] pNFS: Mark layout for return if return-on-close was not sent Date: Mon, 18 Jan 2021 12:34:53 +0100 Message-Id: <20210118113336.403447836@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210118113334.966227881@linuxfoundation.org> References: <20210118113334.966227881@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 commit 67bbceedc9bb8ad48993a8bd6486054756d711f4 upstream. If the layout return-on-close failed because the layoutreturn was never sent, then we should mark the layout for return again. Fixes: 9c47b18cf722 ("pNFS: Ensure we do clear the return-on-close layout stateid on fatal errors") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pnfs.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1460,12 +1460,18 @@ void pnfs_roc_release(struct nfs4_layout int ret) { struct pnfs_layout_hdr *lo = args->layout; + struct inode *inode = args->inode; const nfs4_stateid *arg_stateid = NULL; const nfs4_stateid *res_stateid = NULL; struct nfs4_xdr_opaque_data *ld_private = args->ld_private; switch (ret) { case -NFS4ERR_NOMATCHING_LAYOUT: + spin_lock(&inode->i_lock); + if (pnfs_layout_is_valid(lo) && + nfs4_stateid_match_other(&args->stateid, &lo->plh_stateid)) + pnfs_set_plh_return_info(lo, args->range.iomode, 0); + spin_unlock(&inode->i_lock); break; case 0: if (res->lrs_present)