From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383158; b=pvHnxk4+hH3EvDdYrheGdgxyDMaz3DM5OjQb82zS2Gn3wUgcHmqCH+fhno6rWVuZwXA8 U7fr3bteDwInNUwET8NOnGmNjXK4fGDVdtQTEdZfvL2I5qGxG8GHWjN1/7C75F3Lyw4Ro 3IdBgImSBM90uG7JC1ovTdo1nZGfQ9gGmjXM/+hX+lLn0BTr0XJd5yG8lSrm3J4uu2yQ0 twlRgpgb8wtPNEkWzM8BO1AAGMqhn213ur33jytDVyk7KV6kK1qUGsroc6iCI1onDQO6O THDWJLN7ULPM4KM4e3cLR7Bnr7y1aqRHuRiueW6MvYeO6FDhphKVfXiKM+ZjuZk9bXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383158; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=XFMw+Mogdl7qRnTttVppqPyCZi4wOIwZwVGc7qQSvj0=; b=mjAx6BFiORtNNo/7kM8Mh46U5KrUQnn11W+ojbsZMkdEdT2v0pf80NRl388hfhXlj7xx 0WBsVN3b04FvYK5HBvcWhStKMgtHqPs8sJECH2+a7ERFgROnKbqgg7CPIoqAglcz/+p/6 bnBXLZIh+kw8YWJO8aeyYo6bFQM7wIcm2/STrK7uGPCrtmXdcuYcOwNbmSx76jEsU6M4I hg9liSvUv/ph03qiVvO/fnve2nwYX4Ewyj4LZsQN3UImMfvgffFJfXQ3ahOkZZHf/5LNS 9CLjh5nmgYDcRrgYxZwsuSuAu54hYXn7TzXWZ2Q6GOWcY52dV8OItZtuzTVlFp6CcTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="lQs/w7U0"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBEFD606A322; Fri, 4 Dec 2026 11:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lQs/w7U0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A1261F00934; Fri, 4 Dec 2026 11:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383157; bh=XFMw+Mogdl7qRnTttVppqPyCZi4wOIwZwVGc7qQSvj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lQs/w7U0zDU8g/jw/MBYrnbqyBFaO9pxhRs1UTungJ75aU76d+UzhmkZgW7qOb25G GB5h3x1IyzWDVVM7rlTXQaDByiaPAlUfTOO0ApzTQLX/Jzj8BksBt1e/OdD/y21K1F rqqiDFPXIlJtd6PE3MZ/5ThUsy2te9lYmoxV+vO8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daejun Park , Tejun Heo , Mikulas Patocka , Sasha Levin Subject: [PATCH 6.12 106/555] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Date: Fri, 4 Dec 2026 19:02:29 +0900 Message-ID: <20261204100611.561780872@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daejun Park [ Upstream commit e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 ] For a bio with REQ_PREFLUSH and data, dm core may send an empty flush first. If the flush fails, __dm_io_complete() still reissues the bio without REQ_PREFLUSH and drops the error. When that write succeeds, the XFS log keeps running and fsync() can return 0. End the bio with the flush error instead of writing the data, as blk-mq does. Fixes: 6a8736d10cb4 ("dm: relax ordering of bio-based flush implementation") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Acked-by: Tejun Heo Signed-off-by: Mikulas Patocka [ sashal: adjusted the condition to use bio_is_flush_with_data(bio) directly, since this tree has no requeue_flush_with_data variable. ] Signed-off-by: Sasha Levin --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 11facf9a195cb..403944761d19f 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -983,7 +983,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage) if (requeued) return; - if (bio_is_flush_with_data(bio)) { + if (bio_is_flush_with_data(bio) && !io_error) { /* * Preflush done for flush with data, reissue * without REQ_PREFLUSH. @@ -991,7 +991,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage) bio->bi_opf &= ~REQ_PREFLUSH; queue_io(md, bio); } else { - /* done with normal IO or empty flush */ + /* done with normal IO, empty flush or failed preflush */ if (io_error) bio->bi_status = io_error; bio_endio(bio); -- 2.53.0