From patchwork Fri Feb 4 03:42:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 12734768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC96CC433F5 for ; Fri, 4 Feb 2022 03:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356845AbiBDDm2 (ORCPT ); Thu, 3 Feb 2022 22:42:28 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:50814 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232345AbiBDDmX (ORCPT ); Thu, 3 Feb 2022 22:42:23 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2141hSM6012591; Fri, 4 Feb 2022 03:42:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2021-07-09; bh=HmE0xb3hH+aUxstiJvmsRUlkplpk3vjpuANukSi698U=; b=SienoCq14327GkafJdN0uIN3IvsCWSlGyOG+2ayvxSOGk/dzDDO/NeEol1Obj02QoxL6 Ao8yyvMNz+uGdr3QS9pMihsSyhDzvA2Wl2LWnaAJQr0iIaDN9tTloMMIh4dxLWrRt9zU kqiL5FVRq3ZQBTfa7//nji+nLGrx55AhqrGLmrU75gHA2rHdTOe6meCY38ksiMt574qi AKjdrT9dunspS+PTBZScwlKBR9wWLT+lsgcOPdsbmkf/RCO5jFukcyxZhzkGVcQc6TWS GvuA0PGaAIMcPMhLbXkswUv0CzUuUClrx+FDQwPeWHtYPLNMqTwDAwVcYWDm3TREJzgw pA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e0hevsjxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Feb 2022 03:42:13 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2143fVM8172178; Fri, 4 Feb 2022 03:42:12 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 3dvtq6mfkf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Feb 2022 03:42:12 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 2143gBA0173900; Fri, 4 Feb 2022 03:42:11 GMT Received: from ca-mkp.mkp.ca.oracle.com (ca-mkp.ca.oracle.com [10.156.108.201]) by userp3030.oracle.com with ESMTP id 3dvtq6mfjq-1; Fri, 04 Feb 2022 03:42:11 +0000 From: "Martin K. Petersen" To: linux-block@vger.kernel.org, axboe@kernel.dk Cc: "Martin K. Petersen" , Dmitry Monakhov , stable@vger.kernel.org, Dmitry Ivanov , Alexey Lyashkov Subject: [PATCH] block: bio-integrity: Advance seed correctly for larger interval sizes Date: Thu, 3 Feb 2022 22:42:09 -0500 Message-Id: <20220204034209.4193-1-martin.petersen@oracle.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Proofpoint-GUID: TKgKzsopAs0l1_zIylS2G8x9VO6VNAze X-Proofpoint-ORIG-GUID: TKgKzsopAs0l1_zIylS2G8x9VO6VNAze Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") added code to update the integrity seed value when advancing a bio. However, it failed to take into account that the integrity interval might be larger than the 512-byte block layer sector size. This broke bio splitting on PI devices with 4KB logical blocks. The seed value should be advanced by bio_integrity_intervals() and not the number of sectors. Cc: Dmitry Monakhov Cc: stable@vger.kernel.org Fixes: 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") Tested-by: Dmitry Ivanov Reported-by: Alexey Lyashkov Signed-off-by: Martin K. Petersen --- block/bio-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index d25114715459..0827b19820c5 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done) struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9); - bip->bip_iter.bi_sector += bytes_done >> 9; + bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9); bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes); }