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 C333926CE1A; Wed, 25 Feb 2026 01:41:13 +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=1771983673; cv=none; b=Z9OWBEO8qSCG4KRPPCzETIXfWlWpArndq+pPZ0qHW3vjDAD6eX6sZTM+hIyXTSHM1LBoKuI2M+KgFEJDu+BblI9lFGJN9tQ0/uyym81Pp5DIhYdmJrMY8mSpLTMTPVjlg5EQhAz4B92NuVXK4Wr/eEbs66Iq97d3AdvdHXKY3xY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771983673; c=relaxed/simple; bh=k3JELUXMTEHML+CbDHUV8jZTBpizpDLnnGy6qQJRVvk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=stAD1C3cVkQZtmrmyygWlWpoEHm9uYOcluzdlIUeMU5j7kiknWsTHRqCnJoYvG+FCPFuUHASivrSoDkms9t34EJQNLKO/f//fnxt+Ggnhcd+jj+z/fNObxYX4IEbna0LPA1+bw7gZPKFFndg+ICuFh1RAyc0QCphM1PCArln+wM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FD8ONlih; 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="FD8ONlih" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5ABC116D0; Wed, 25 Feb 2026 01:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1771983673; bh=k3JELUXMTEHML+CbDHUV8jZTBpizpDLnnGy6qQJRVvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FD8ONlihR1vppEy8csg/YmfypPCExf5WFOdoEJSVxddsynIEs0ItFrZcfl+i99RdO 6SKdPu10h1FI4FJyP33kVFMxabOtK8yATX69eWDtXOc+9KnzagkatDdb+fbzYoBodC jH+OqqKP0Q9FJz/8SIYLZjS/mIKaNm1NVS+5ozxU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Yi , Baokun Li , stable@kernel.org, Ojaswin Mujoo , Theodore Tso Subject: [PATCH 6.19 759/781] ext4: drop extent cache when splitting extent fails Date: Tue, 24 Feb 2026 17:24:28 -0800 Message-ID: <20260225012418.333087565@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260225012359.695468795@linuxfoundation.org> References: <20260225012359.695468795@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhang Yi commit 79b592e8f1b435796cbc2722190368e3e8ffd7a1 upstream. When the split extent fails, we might leave some extents still being processed and return an error directly, which will result in stale extent entries remaining in the extent status tree. So drop all of the remaining potentially stale extents if the splitting fails. Signed-off-by: Zhang Yi Reviewed-by: Baokun Li Cc: stable@kernel.org Reviewed-by: Ojaswin Mujoo Message-ID: <20251129103247.686136-8-yi.zhang@huaweicloud.com> Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/extents.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3267,7 +3267,7 @@ static struct ext4_ext_path *ext4_split_ err = PTR_ERR(path); if (err != -ENOSPC && err != -EDQUOT && err != -ENOMEM) - return path; + goto out_path; /* * Get a new path to try to zeroout or fix the extent length. @@ -3281,7 +3281,7 @@ static struct ext4_ext_path *ext4_split_ if (IS_ERR(path)) { EXT4_ERROR_INODE(inode, "Failed split extent on %u, err %ld", split, PTR_ERR(path)); - return path; + goto out_path; } depth = ext_depth(inode); ex = path[depth].p_ext; @@ -3358,6 +3358,10 @@ out: ext4_free_ext_path(path); path = ERR_PTR(err); } +out_path: + if (IS_ERR(path)) + /* Remove all remaining potentially stale extents. */ + ext4_es_remove_extent(inode, ee_block, ee_len); ext4_ext_show_leaf(inode, path); return path; }