From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 125BD46D572; Sat, 12 Sep 2026 10:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789210173; cv=none; b=oDRdbEVWZfwg8uMFRQmo5RVbX09E/LTS1DdM7Ij94Hy0MU36WMN9kVZ0HXOqOHp7m8IGSjcsLf2XKrzNB3S1kDMrh4CBIDNnTEWXbeg7k9Kh5EBJfIvYlAfUdbg0+cb61sNP+GzvKFU3dyfyAZEMUHe6RmLGPJ1fkUcpoQ7+STc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789210173; c=relaxed/simple; bh=Pr9a/dPVM6D/QzwB0zFGPJd9hNwMJs4oSyJKCY/xubQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dntvf/1Xd0HtkkLUWqtPSmPBE5jrUOJX7KZdP3GmNejhTZYOum1wdonLH3xoB/IbpprQMHSNzXWVaUZJkeXBTmDUsGQjhdqYaDWPYLi+MVJDJ6LZnKnDEMGe7Q2HJyXW7okUl5i3kjr6AesG9G1x4Sm8H091kKzGmpyj6Kw+fOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fxER5LcL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fxER5LcL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093301F000FF; Sat, 12 Sep 2026 10:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789210168; bh=AbuX6jv6alDxqcThCoXdO9Aeh+KdBhl+Ajvt7OsWdKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fxER5LcL3SWsl/vTTaGe0nLU8boMKqH1guUAfN/1UpxODONpp1H0Tf/5oGMGXoMak Q5+RUPDf55m7B1sLt970+rzkvU6/0PfOdCi1oqjhm5o3rRS4CYUz3LbckMRcxPIKij nswPsXIJG5y+n1pKyuhJX1Jbp7C/PIAb17PEXbGA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mykola Marzhan , Yu Kuai , Sasha Levin Subject: [PATCH 6.18 0964/1518] md: avoid stale clone I/O accounting timestamps Date: Sat, 12 Sep 2026 08:52:13 +0200 Message-ID: <20260912065645.267981449@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yu Kuai [ Upstream commit 45102fc8330525d35675b1c193242bba101df5ee ] md_clone_bio() always allocates the clone from mddev->io_clone_set, even when queue I/O stats are disabled. In that case it does not call bio_start_io_acct(), but it also left md_io_clone->start_time untouched. The clone private data comes from a mempool and can contain data from a previous user. md_end_clone_io() checks start_time to decide whether it needs to call bio_end_io_acct(), so a stale non-zero value can make the completion path end accounting that was never started for this bio. Set start_time to 0 in the no-stats branch. This keeps the end path tied to whether bio_start_io_acct() actually ran. Fixes: c687297b8845 ("md: also clone new io if io accounting is disabled") Tested-by: Mykola Marzhan Link: https://patch.msgid.link/20260802195038.164272-8-yukuai@kernel.org Signed-off-by: Yu Kuai Signed-off-by: Sasha Levin --- drivers/md/md.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index 2e8e32e15e735..d03d0fdf763db 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9313,6 +9313,8 @@ static void md_clone_bio(struct mddev *mddev, struct bio **bio) md_io_clone->mddev = mddev; if (blk_queue_io_stat(bdev->bd_disk->queue)) md_io_clone->start_time = bio_start_io_acct(*bio); + else + md_io_clone->start_time = 0; if (bio_data_dir(*bio) == WRITE && md_bitmap_enabled(mddev, false)) { md_io_clone->offset = (*bio)->bi_iter.bi_sector; -- 2.53.0