From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F3D07341AB8; Tue, 16 Dec 2025 11:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884822; cv=none; b=f9iM7oyLcnPaRpvYK/Nlvj6f/wAgkIuI43BSgOZQwa4aKMZPUx/b72X/PLG944ixHUyjBDkxaHSNu/jyYwPY8KVg+AjwwVE9D1VAYxWtkAISBzVtlvw2wG3h2TRKBhXybWfRZtdggi4RKHccUot3SpF2KcvD+wE4aMo3NqOVAQg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884822; c=relaxed/simple; bh=5Bh1QwFDopVjva/YTkkRR7PehBZjNtvjIseggqG48aY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YHWAlIVgDZYMx91r5NKQJSYMIhn4+quWGsXnpK4aanFUmb+9ZYJFWOACExDOWeoQGhZFConVAwprxCxT6tRBbQ1mU2h2i9hE0TpamTqi0fHX9li4lfWuUWnUf2JzWdSeewiGWbaGZlqSRuLqb8MlSRKdy1yTpMEa8Cqlt9ttDhc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=At3NYy2b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="At3NYy2b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FADC4CEF1; Tue, 16 Dec 2025 11:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765884821; bh=5Bh1QwFDopVjva/YTkkRR7PehBZjNtvjIseggqG48aY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=At3NYy2bRWL2PFpaJLf7sNhrT9NMe794sI370Xkab2IcRN6b3SR77chEn0Ptii3YF CZ3HnEr2g+hkJ3lfU1e4iPKSWb0w0zL8NER0ZZ2Ylv+Ei8aQ0ofxkWmF7N4XkXksSg R0n5wSo9qXq5HHy2veK5WA4TyzDdH+r845blOTpc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jonathan Curley , Trond Myklebust , Sasha Levin Subject: [PATCH 6.12 308/354] NFSv4/pNFS: Clear NFS_INO_LAYOUTCOMMIT in pnfs_mark_layout_stateid_invalid Date: Tue, 16 Dec 2025 12:14:35 +0100 Message-ID: <20251216111332.071227453@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251216111320.896758933@linuxfoundation.org> References: <20251216111320.896758933@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jonathan Curley [ Upstream commit e0f8058f2cb56de0b7572f51cd563ca5debce746 ] Fixes a crash when layout is null during this call stack: write_inode -> nfs4_write_inode -> pnfs_layoutcommit_inode pnfs_set_layoutcommit relies on the lseg refcount to keep the layout around. Need to clear NFS_INO_LAYOUTCOMMIT otherwise we might attempt to reference a null layout. Fixes: fe1cf9469d7bc ("pNFS: Clear all layout segment state in pnfs_mark_layout_stateid_invalid") Signed-off-by: Jonathan Curley Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/pnfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 89d49dd3978f9..7a742bcff687b 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -466,6 +466,7 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg, *next; set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); + clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(lo->plh_inode)->flags); list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) pnfs_clear_lseg_state(lseg, lseg_list); pnfs_clear_layoutreturn_info(lo); -- 2.51.0