Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp154258pxu; Tue, 5 Jan 2021 07:28:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUy6gwt1UBMiBhVB/Xoagcq3zXp539za3aHsMlrUsqpDXe208iTa79mvQbg0I2/BLmH+6F X-Received: by 2002:a17:906:7e0b:: with SMTP id e11mr69610289ejr.533.1609860517426; Tue, 05 Jan 2021 07:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609860517; cv=none; d=google.com; s=arc-20160816; b=gmUr6QdTL/S5DujVnGaiCNwMNMdJxPfm8rK5VSbW2wANlN7uaJ42PRVbPKkuMKuaVK Xic9m3OvoUBu75PvUy0v7OdeSkBduR+LiwFCq/lLnw20ZhecBRflHR2EA5x+1eu8STiY NoWOI8sgMjZSqtvyWd9M72rdcQqAH9oWrmXldyB60dZQY3qZYXwpASYEawq847Vt+SOi 37fRXqjxXDlyOI0grfGGQ2h44pAb4sV8+x3+VTbuZr/pOUkFSEn3lCdz/eDwz6n4WlwL 3ctc1h84kzej3C03CNKjE4B4KVI/2dlI/s+GAGza57lz1GLK9PCA5cvAnvMO0wtqjwCD CuMQ== 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=A3/FUA6TKexNvaDeeWz+angsOKDqX1ICNI7TuO9DvRk=; b=OZB13mCAIeNaHTp0/lVYMLF1bWXwD1nKL3Vhd8oFvuX4hZc1WhwI7tb4fZmUHSyXy4 4/ajYE2RyZ8x8f2f20kFOE6Bdqi1Yu5Ft1x9/DJnmHlsUWIe6+MQZshLzStrGO4jixpq uPt4fUmaqLtWuhNb0sS+IVB40s043odTT5FK9JzS4iJZxkdy+klwfcCB5/EYiPswdF/B CLOMiDORHWEtZ4la7To/FmgQW4pTMHWI4G9hi6xLfo3pVB0xw8U4lCXmKeE/mdL9586r ZbYo+Gx3WHVdiaewLrf0AbAPosLtudlT8h9m26kQJiWwge34VWrrL3UkiNXSRk0Iz1CT xcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nfUD5Uv3; 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 n5si35077612eda.301.2021.01.05.07.28.14; Tue, 05 Jan 2021 07:28:37 -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=nfUD5Uv3; 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 S1727693AbhAEP1E (ORCPT + 99 others); Tue, 5 Jan 2021 10:27:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:59496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727171AbhAEP1D (ORCPT ); Tue, 5 Jan 2021 10:27:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0EA7222B4B for ; Tue, 5 Jan 2021 15:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609860383; bh=ZebdL5Lac/QocOqW9q6V5iyXRLtHDhEINPK5zKxu6eI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nfUD5Uv3TYn5A/dlR5LFld/ku6KIE6BW3rsybECuVhFaq+Xo3TtEGeIrrCvQ0GDH4 ZSpF1Yq4bu0puItQAcYL/2Q7KKob/JGzm8C6IcH02LpflPwvqKMGP9hkdqAEicsejN 19sjuGDNnMe62DC4JvK9nRdvRN2YYshXwstR/RvZt9MiMb/JvfMMjfoGxgKV1eNhzW uvgxXViguchXTAb36GE4vKURrQdS44Y/KREswNRJPG1TLaXJ4HJDxvDLxijlrnXzF5 P4/vBuboo8ceaGrRZibN02sXBwdT3sp59exQfRhAUcLF20tZ1eK6+6ATxSx49SejCI UQM75sKXwvheA== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 3/4] pNFS: Clean up pnfs_layoutreturn_free_lsegs() Date: Tue, 5 Jan 2021 10:26:19 -0500 Message-Id: <20210105152620.754453-3-trondmy@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105152620.754453-2-trondmy@kernel.org> References: <20210105152620.754453-1-trondmy@kernel.org> <20210105152620.754453-2-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 Remove the check for whether or not the stateid is NULL, and fix up the callers. Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index a18b1992b2fb..a0d8a67a4dd9 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1152,7 +1152,7 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo, LIST_HEAD(freeme); spin_lock(&inode->i_lock); - if (!pnfs_layout_is_valid(lo) || !arg_stateid || + if (!pnfs_layout_is_valid(lo) || !nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid)) goto out_unlock; if (stateid) { @@ -1559,7 +1559,6 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args, { 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; @@ -1576,11 +1575,10 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args, res_stateid = &res->stateid; fallthrough; default: - arg_stateid = &args->stateid; + pnfs_layoutreturn_free_lsegs(lo, &args->stateid, &args->range, + res_stateid); } trace_nfs4_layoutreturn_on_close(args->inode, &args->stateid, ret); - pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range, - res_stateid); if (ld_private && ld_private->ops && ld_private->ops->free) ld_private->ops->free(ld_private); pnfs_put_layout_hdr(lo); -- 2.29.2