Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp645762ybf; Fri, 28 Feb 2020 05:06:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwPLG5LZPmvIj4ubLN4GuO9EGhubB3AbhkECRRT7JKrDToeqmsVmr3q8QwJunaKmI/lhKVO X-Received: by 2002:aca:b483:: with SMTP id d125mr3083925oif.167.1582895187613; Fri, 28 Feb 2020 05:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582895187; cv=none; d=google.com; s=arc-20160816; b=F6sjqDbCMpY2X3Ln0yxCLdgfgF4RRY8Cv2mif1UtAmmMlMWN/XLws4KS8h5HTWJK/3 8XX/NWFr3bHuIrn8gjHGHj8SP+FrBrvGrRBWPNjz9jRg3+fKmFvpCdEBpOBT3cG0jXzS BkqkOOzJoCxBD3wILsLsOnFUClmvj3qAmVh9WXgIplHA28kqRs8YTkCl4ZyA+UrhEiNn uA1rwpkr8/hyhslFXJ7sxdXt+1dW94cqFDwCIx/jYEBUJrZPumJaquErBwS4pP3V+B+j FjoSkoPug+pfgQMd6E/jr+fgJAFazOM/di8LBVi3qvKz0kStfDMOqhO6HZAEv5shdJC6 VJbg== 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 :message-id:date:subject:to:from:dkim-signature; bh=Hr0LWdvFHWRgEKUvjromwmkN1mjnm2zlJDhDG0GqlLM=; b=z+EmAO//TpyI2fKc90NewPYNvAayPVIdh8NgSXrw+UvLa15Mpk+R1sNNdJfMKkVR8Q YVuCJ96PZXhEPL82Ge6gQBErnZQaEFyOd+OsziTlrHr+4vbfa/PaWed/WDnF9Nk2w8/e W3UQGmvgIIdyYgarH8/IOCX4syeRnbuAcbQUf8Ytk84JqqLtcbR5KexQm9pwECIKmugv WOHVJ7su4Qu802LswgKRwFeY7wRy+E5D5JebtEZ5Ig6AAvHkerVPBPXWylPp2TNJvAOU M1wDWujtqFF2ANbvyo8HW2ld8/hcdx52D3pguJxqWG7LWVaWGPl9zfcM233+LRcxmho6 q6iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cm03edS5; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w207si1838221oia.226.2020.02.28.05.06.11; Fri, 28 Feb 2020 05:06:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=Cm03edS5; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725928AbgB1NFm (ORCPT + 99 others); Fri, 28 Feb 2020 08:05:42 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:39471 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725861AbgB1NFm (ORCPT ); Fri, 28 Feb 2020 08:05:42 -0500 Received: by mail-yw1-f67.google.com with SMTP id x184so3190458ywd.6 for ; Fri, 28 Feb 2020 05:05:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Hr0LWdvFHWRgEKUvjromwmkN1mjnm2zlJDhDG0GqlLM=; b=Cm03edS5qphJ/MNu5NST1isf0c2hnYmqxhurNxMogDkXYkXrk6bXwTh0G/SJ+AOET0 IHk8hT6xvK7YomgIovDZrEbd5AFuthNrXdv7j8gTK6LXWAkpKJzqZ784PsQSUp3hwAzl X6ASPbvF4t9CkH197qK8zNUQeFg2jSXmkFuLeSzOl+aqQOF9s3mJxbVCXkmW2qJsLJmP W5DJVKRsSKeobTVIvewTKr1xq3Ca15FGPoOAzyXSJqdlbt6cIwm8PxHV1bxBJpjgj9Mp 099Ml70NIWbxqBTACz52OtWhltRPSWTLqtP+AF6psEF/dSgjwFvPtS25wJrj9Sz/9qGL kdPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Hr0LWdvFHWRgEKUvjromwmkN1mjnm2zlJDhDG0GqlLM=; b=SK5yQUcLz5I+HKp9oPmk+mvO2m9W6bpUBjTGOB17Wp/zeVNWjPFcEtJTHXb/4O1+DR IsVXCaBTtj+3kVcx8rgWRF0LBS6yi5radtRgc6p6JH4MteKRMjexXV/DdrfP5oaMKD1U +TafK08eLZFZicFIj5quo+JivlCI2+Db4A6vatT8nSHCibQt1zbUlNijAx2uOfNrJa5F N/2ynY4LOgERnra4OReX6a1uZQZgSltCRo3yADtoG5MLSymcGJ5vb8cjmxTJir7kj01x 9Uclyw95XSpcySCFzmUUfXf1p4R5g2nbJ+jf+0zr5Xj4PM9O/E3UrAjLQ9kGpRsui88i 61tg== X-Gm-Message-State: APjAAAWuLMmLCuAzshpNkZjGyMdejV0TesYeh98SA4op87m6SYRE5pG/ Oph+lHMT1jyrZMUfRlxX8X4jqbOrcg== X-Received: by 2002:a5b:383:: with SMTP id k3mr3501502ybp.260.1582895140696; Fri, 28 Feb 2020 05:05:40 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id v5sm3735042ywh.23.2020.02.28.05.05.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 05:05:40 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH] NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid() Date: Fri, 28 Feb 2020 08:03:31 -0500 Message-Id: <20200228130331.1330189-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Make sure to test the stateid for validity so that we catch instances where the server may have been reusing stateids in nfs_layout_find_inode_by_stateid(). Fixes: 7b410d9ce460 ("pNFS: Delay getting the layout header in CB_LAYOUTRECALL handlers") Signed-off-by: Trond Myklebust --- fs/nfs/callback_proc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index b6ffac9963c8..eb9d035451a2 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -128,6 +128,8 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp, list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { list_for_each_entry(lo, &server->layouts, plh_layouts) { + if (!pnfs_layout_is_valid(lo)) + continue; if (stateid != NULL && !nfs4_stateid_match_other(stateid, &lo->plh_stateid)) continue; -- 2.24.1