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=1796386118; b=jhjmfzkvloOdY/JZhjfRFtlVaGhWHE0HqLjbijQ7kY3S2/j9/Uq06u6Fi/8a+nGZazQE ZONTcl2XeOpCRKjmobwxs9i0KPJwHUn6g9aZcvH5/LPU/FzAfGGn2MX4oulSIU4UnJa5L T61KCKWluADd+fHCmv4i3zqOZW0WH5j9Hxqjis64o7IDGL63ZU0qHkBDJM+zKoDsVsRyH kAgO+1dcdavar+tE2UTs/1qzCpAO76U1tzvDQUoED3Qg79kyUXwAwc6NZRYvQM4jTsr/H BMDUsigbZNk2DI7e8Ip8POd5xHzM9vavJ1RdZGiSOuhCHgZt0r+AXVjCKyXdjAGJ4Iw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386118; 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=nT7BSkzmNaul5ZeqFzMaa5xuzracIPhrPwT2t7kK1h8=; b=l6aNOYL5BizaYxWNmcC+hJnsGR3D2O2Xjryyf0D09G7R7E75e88HUR3JVn95Pa9sweOB USSA8jg47ZxvgYEcWzd/9EC/NTu2RZbeqv/JwbeaT8iP9TKzFugVJ+ZNlLxU2A7RyxHqs wq9GRKTY7MC0IwadflpkqaIgX5xVu2CvdfA7L1FpMu93O4mpFa1cZ7fctw5uIaLuqwO2q 3Qcefow/shMyF3CEV+RaZB3ZN5PhwZCnurgUrS7PYiXuLlUpRH9X7anq/rjC7jiglsIUJ UG2VZwTkgL0he8+9x+DsgljkfPRoYPRXSkBH8j3BIETFvgSu78h4v7mTAjcor5gl07g== 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="MQUVo00/"; 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 0B9E2606A322; Fri, 4 Dec 2026 12:08:38 +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=MQUVo00/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75F971F00897; Fri, 4 Dec 2026 12:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386117; bh=nT7BSkzmNaul5ZeqFzMaa5xuzracIPhrPwT2t7kK1h8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MQUVo00/Bx8siijSccuQgSp8PSXt4AAn8b6PnZ1SQz/nVNkfHLZEusBY+o39Qc5X4 tjadK9R4tfZqda65Mbblpbkj5LfuvnseFWItfHear1+q2Ot8K9DwU87ngF0OKT8kHS SXyeoo0QkKADbc7AJLIrbmiaaOXH/eUTxGaHK5iM= 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.6 0808/1167] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Date: Fri, 4 Dec 2026 19:03:55 +0900 Message-ID: <20261204100723.173165989@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 e4ebdd3d56d47..ee729dafd924b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -960,7 +960,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. @@ -968,7 +968,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