From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.222 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796480374; b=BYLXZVyKFeaWsptGp1zawkt2s6LrLGq1G8o887mURk38Bji/VD2Rmr/4lFAtdJXB09Cl yQu2fdaZftnHFSmj4Vyw9CnE9FYxXjDu2oI3Ax3UDYXkZCwCXd1sUpdPCcjI41vKtgMkG +RMByG/o2esCH4XPO/K00lVj/lNNjFHDLk/JBNEAW/sUCB9VSAfCZlBA0VEQUXOAHuaiv KOl8MwHmiBb6rFT8DIEJM784MZS9QfJnGQoKMQ9iYalr75A02i3ge+WMn5rdOHy6EKZyb sc4Xps4ls2GgYU6AXxnewYs6W9pWSGQMQ/NoagitnZcgPZk9Ea/5qOGrw+PoMvK6gMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796480374; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=aBjfi9muPEL64+AT5b0wbyXBosMpWWwCnX2bngA55L0=; b=LYv1dMgvksxbP/ZH2x0d1owxitSJOwPH7ugS9ZDfBM6gZN0TEJgiKRKhLF7bDj04LHgF q8Bj4WfFC1LcCqufmkpk8GZgfLIL8FMnrNgguWXv/X6wWWxssums+bCoMhtWtpNVmqfIC mY8Tr1cr5lcL5ANhpOll7coLDA6VFEOgsw8Qv65AxrKM2LE5D3p3q5Is/0nV5KPyJHnqM j2xYMIvXIHZ5djihVKOiHMvdVB2JdsEQl5wMYkVYKWFqWeqWRyWKQuLIwxsMVIydI6/fM kyBZD1UNeoXm4E2FxHXZ7em5uEzvBTxtV1UjAw8JD9ZDQrpAwqoYeSDWPWCu6UoQgPw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b="J/cuJlph"; arc=none smtp.remote-ip=91.218.175.222 Received: from mta0.migadu.com (out-222.mta0.migadu.com [91.218.175.222]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB1CF606A33B for ; Sat, 5 Dec 2026 14:19:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB1CF606A33B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=J/cuJlph X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=hfmPlU7h7tOQkn7C16/5brdeUfMicPxAgg+lhvZr68U=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796480370; v=1; x=1797085170; b=J/cuJlph9sUpQ97N2JlPI9lv+dF8tXgRAoaujIgFBanyEJxsShGogReLY1GHdhUrE3kHZTRt 78duzwd+SiUTVczTH3GOHAwF7HhtYmADx5fUKKlxtVeyfJ4YR4UdkhyWDfcdXbJQX/NymG9Zqiy lTF9899lzCnDiKjrUQeLY+Yc= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 5a84e96af7e9ec48; Sat, 05 Dec 2026 14:19:30 +0000 X-Mizu-Trace-ID: 5a84e96af7e9ec48 X-Migadu-Flow: FLOW_OUT From: Md Haris Iqbal To: Jens Axboe , linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Christoph Hellwig , Jonathan Corbet , linux-doc@vger.kernel.org, Md Haris Iqbal , Sashiko Subject: [PATCH for-rc 2/3] block: clear BIO_ERROR_INJECTED when a bio changes device Date: Sat, 5 Dec 2026 15:19:11 +0100 Message-ID: <20261205141912.37608-3-haris.iqbal@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261205141912.37608-1-haris.iqbal@linux.dev> References: <20261205141912.37608-1-haris.iqbal@linux.dev> X-Mailing-List: linux-kernel@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 BIO_ERROR_INJECTED keeps a bio that was delayed by an error injection rule from being evaluated again when it is resubmitted. Rules belong to a disk, but the flag stays set when a bio is remapped in place to another device with bio_set_dev(), so the new device's rules would be skipped for it. Clear the flag in bio_set_dev() when the device changes, as is already done for BIO_BPS_THROTTLED. With nvme multipath, a bio delayed by a rule on the head disk loses the flag when it is remapped to a path, so on failover it is checked against the head's rules again. Fixes: 6bd856cc9996 ("block: allow error injection rules to delay bios") Reported-by: Sashiko Link: https://sashiko.dev/#/patchset/20261111215838.103356-1-haris.iqbal%40linux.dev?part=2 Signed-off-by: Md Haris Iqbal --- Documentation/block/error-injection.rst | 6 +++--- block/error-injection.c | 4 ++-- include/linux/bio.h | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/block/error-injection.rst b/Documentation/block/error-injection.rst index 3c86defddb80..a4ccbf5d1558 100644 --- a/Documentation/block/error-injection.rst +++ b/Documentation/block/error-injection.rst @@ -56,9 +56,9 @@ Delays A delayed bio is held above the driver, so the device never sees a slow I/O. A delay does not reach the blk-mq timeout handler or SCSI error handling. -A bio that matched a delay rule is not evaluated against the rules again, even -after it is split and resubmitted internally. Removing a rule does not release -bios it is already delaying. +A bio that matched a delay rule is not evaluated against the rules again while +it stays on that disk, even after it is split and resubmitted internally. +Removing a rule does not release bios it is already delaying. Holding a bio back reorders it against bios submitted later. On zoned devices this breaks sequential write ordering and the block layer fails the diff --git a/block/error-injection.c b/block/error-injection.c index 88544eb41c08..c883602ac0c9 100644 --- a/block/error-injection.c +++ b/block/error-injection.c @@ -79,8 +79,8 @@ static void blk_error_inject_delay_work(struct work_struct *work) /* * Resubmit. The BIO_ERROR_INJECTED flag ensures that a bio that was - * delayed once skips error injection entirely from here on, including - * any other rule that covers it. + * delayed once skips error injection while it stays on this device, + * including any other rule that covers it. */ submit_bio_noacct_nocheck(bio, false); } diff --git a/include/linux/bio.h b/include/linux/bio.h index 7a794ce723b8..facb80b33183 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -571,8 +571,10 @@ static inline void blkcg_punt_bio_submit(struct bio *bio) static inline void bio_set_dev(struct bio *bio, struct block_device *bdev) { bio_clear_flag(bio, BIO_REMAPPED); - if (bio->bi_bdev != bdev) + if (bio->bi_bdev != bdev) { bio_clear_flag(bio, BIO_BPS_THROTTLED); + bio_clear_flag(bio, BIO_ERROR_INJECTED); + } bio->bi_bdev = bdev; bio_associate_blkg(bio); } -- 2.53.0