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=1796388766; b=OSQzfYZU5kZOgdE2ZcsSjcz27keH/qM8a1KNAswSDZDGaIfEWsLwR6n2s90dyGVPaSuS YzOwkQ6D99qLRtjPoOQGxlo9GjuGA4U5GXHrEdbgffPB2i0oqB989L+BZD90PtS3ps5XK pr5EE7J0S6zXBcJWpmtNWiitJ87n7k9Mw7ztH7c7hcDBpiUG0xLz5ATiaxwXbYHFJRdlv UUwzD60q5Tc/bcsj9Mg8qHVH4oQRSPu9VI4rkU/JD6O+SkCT9nFcmrWXKr9b5ksnkI/f2 9RjGvqXIQ8ORkfSvErumpIh3e/+bm2YiN4OfBsiIu8JeykLgnzU9UZ0iVu2lP/f2+uw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388766; 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=+Nx/XRmyt8vX/Avt2uVfpaif9ITTqjuJuRf2lBChE4U=; b=Duq59ZwUeRsgcN+dUZCSzCG4bXCZ0FQFTPpcmGYhB/CeO4uXvKd4zD2keFWTe4hcPU5Y T0T1fad3Ti/sKuRtO00RaiQNdsqzutClvvr6jrIN4Os7xT6CgxEjvK6qVy+ipp8ugGy/B E6mOMTok/fADObPYynFgvzN7d6Hlbjz8O1PiI3KktE4Xz/QFId5AwulxyOrcZ6xSW0hks bj6Q/bL5TT885cHTkw2l1WYV/FihoaEmNv+Z1y44K5TexVtBHZIY0xT+46SQBljcagATB 9DO7bOrM2lXXcVex8L7XQnxMQSdoULh2sXU6++wgTe9od+rshCOH99ZA1Q6E3WFfD5w== 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=SMIYSwtl; 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 40CEF606A32D; Fri, 4 Dec 2026 12:52:45 +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=SMIYSwtl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A9FF1F0092C; Fri, 4 Dec 2026 12:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388765; bh=+Nx/XRmyt8vX/Avt2uVfpaif9ITTqjuJuRf2lBChE4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SMIYSwtlNUrtjMDqRFKkW0SXu5F3bVFQn/h5HVcIezJU6/lMKggC3VpPaIHuYG96F i7QlYYFW1ag6Ar7C7MmgVItErQI4C9dREF8ivxUwPDMCkBK7VgkG0srYM998HzPeFE dnzdIZyn+f7KnfB9FQtTxqPCfvqFuskaIGpUqmOY= 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.1 0744/1059] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Date: Fri, 4 Dec 2026 19:04:35 +0900 Message-ID: <20261204100703.262877201@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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: Adapted the condition to the older code, which tests bio_is_flush_with_data(bio) instead of the requeue_flush_with_data variable, and added the !io_error check there. ] 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 0af19f3116108..0a3375309f822 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -965,7 +965,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. @@ -973,7 +973,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