From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44391313273 for ; Thu, 18 Dec 2025 05:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766037465; cv=none; b=bxcdKupb91YzlBgwGWTiRIKf9ShWupPkH2S9lQh16EOeIuAINFo4GyDY8DmnVoIBgXm30nR46vJt4aC/zq3nOegnj/5vvUAcqepQhpd8CacXWXFZevXTxT4fwn8FaK5r4crRMWr+YRy83vItDxQUk/GIweqrKJZBq3K2yRXXXMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766037465; c=relaxed/simple; bh=uckptuftgY9bmYmOtVjKbYtslBt7z4LgcgoRgDtYjgY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V64IFNq702DyuRYU2+oO8ows4VXcQcBXniL4JP2PPg3Vu598BPxuiUVXg/hGudZDRn2+S5ArMSWS7WX5JbbCkBH7H4951XZic4shFaTHearSLIwhBWn7Jgtv44sG8Coivj6NpTZjV+voz1FD4aqs12YVq9OvchNAtgV1QI/kvIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=2UUUaoOh; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="2UUUaoOh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5MHzjSEHdv4zVAf9PHK3wEIZKXZQ5V5xDGMexmdKte0=; b=2UUUaoOh6vx/qKM5KZDAtJkbTH 4bc03hoPzo30M45DgTmNCK2gKn+d0pNtk06e+JFgR7aklwq8fz/NXJlUZDglYe5s2YVctSA3DUili O5kgWEFsryWYVJJc72DRA/tKyH/JXq6PBYJvJPZtGyy/yu4yMiF4r528UVul370sbxmVjKXDY3wjO Xq4Qv9T3hDRB5PiPWmYVTYki7QoTB5sblHYu+DR64547YSNmyOey65UV7TBJmO0PttIra2nzAP8DW SDfTbV+5CRt8VPDbLjdY6eniMKushJkRLOEbkNsydVMNkNZlp67Hr0oXIEPcisJ4kMsx7IXoaNRMZ SV0UdRMg==; Received: from 2a02-8389-2341-5b80-d601-7564-c2e0-491c.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:d601:7564:c2e0:491c] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vW71B-00000007rii-1b6y; Thu, 18 Dec 2025 05:57:41 +0000 From: Christoph Hellwig To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 15/24] NFS: move the deleg_cur check out of nfs_detach_delegation_locked Date: Thu, 18 Dec 2025 06:56:19 +0100 Message-ID: <20251218055633.1532159-16-hch@lst.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251218055633.1532159-1-hch@lst.de> References: <20251218055633.1532159-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html nfs_inode_set_delegation as the only direct caller of nfs_detach_delegation_locked already check this under cl_lock, so don't repeat it. Replace the lockdep coverage for the lock that was implicitly provided by the rcu_dereference_protected call that is removed with an explicit lockdep assert to keep the coverage. Signed-off-by: Christoph Hellwig --- fs/nfs/delegation.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 6946b48584f8..f7d5622c625a 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -350,15 +350,10 @@ nfs_detach_delegation_locked(struct nfs_inode *nfsi, struct nfs_delegation *delegation, struct nfs_client *clp) { - struct nfs_delegation *deleg_cur = - rcu_dereference_protected(nfsi->delegation, - lockdep_is_held(&clp->cl_lock)); + lockdep_assert_held(&clp->cl_lock); trace_nfs4_detach_delegation(&nfsi->vfs_inode, delegation->type); - if (delegation != deleg_cur) - return false; - spin_lock(&delegation->lock); if (!delegation->inode) { spin_unlock(&delegation->lock); @@ -378,10 +373,14 @@ static bool nfs_detach_delegation(struct nfs_inode *nfsi, struct nfs_server *server) { struct nfs_client *clp = server->nfs_client; - bool ret; + struct nfs_delegation *deleg_cur; + bool ret = false; spin_lock(&clp->cl_lock); - ret = nfs_detach_delegation_locked(nfsi, delegation, clp); + deleg_cur = rcu_dereference_protected(nfsi->delegation, + lockdep_is_held(&clp->cl_lock)); + if (delegation == deleg_cur) + ret = nfs_detach_delegation_locked(nfsi, delegation, clp); spin_unlock(&clp->cl_lock); return ret; } -- 2.47.3