From patchwork Thu Jul 26 18:39:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Edwards X-Patchwork-Id: 10546311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 107AD14BC for ; Thu, 26 Jul 2018 18:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F10752BC7B for ; Thu, 26 Jul 2018 18:40:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECF862BC20; Thu, 26 Jul 2018 18:40:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 111822BC20 for ; Thu, 26 Jul 2018 18:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730581AbeGZT6R (ORCPT ); Thu, 26 Jul 2018 15:58:17 -0400 Received: from legacy.ddn.com ([64.47.133.206]:28777 "EHLO legacy.ddn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730323AbeGZT6R (ORCPT ); Thu, 26 Jul 2018 15:58:17 -0400 Received: from LAX-EX-CAHT3.datadirect.datadirectnet.com (10.8.103.85) by LAX-EX-CAHT3.datadirect.datadirectnet.com (10.8.103.85) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Jul 2018 11:40:12 -0700 Received: from LAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) by LAX-EX-CAHT3.datadirect.datadirectnet.com (10.8.103.85) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 26 Jul 2018 11:40:12 -0700 Received: from soma.datadirect.datadirectnet.com (10.48.114.40) by LAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) with Microsoft SMTP Server (TLS) id 14.3.389.1; Thu, 26 Jul 2018 11:40:11 -0700 From: Greg Edwards To: CC: Jens Axboe , "Martin K. Petersen" , Dmitry Monakhov , "Greg Edwards" Subject: [PATCH] block: reset bi_iter.bi_done after splitting bio Date: Thu, 26 Jul 2018 14:39:37 -0400 Message-ID: <20180726183937.23814-1-gedwards@ddn.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.48.114.40] Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After the bio has been updated to represent the remaining sectors, reset bi_done so bio_rewind_iter() does not rewind further than it should. This resolves a bio_integrity_process() failure on reads where the original request was split. Fixes: 63573e359d05 ("bio-integrity: Restore original iterator on verify stage") Signed-off-by: Greg Edwards --- Simple test case: # modprobe scsi_debug.ko dif=1 dix=1 guard=0 dev_size_mb=1024 sector_size=4096 # echo 512 > /sys/block//queue/max_sectors_kb # dd if=/dev/ of=/dev/null bs=1M iflag=direct count=1 block/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio.c b/block/bio.c index 67eff5eddc49..f33a030b9dad 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1866,6 +1866,7 @@ struct bio *bio_split(struct bio *bio, int sectors, bio_integrity_trim(split); bio_advance(bio, split->bi_iter.bi_size); + bio->bi_iter.bi_done = 0; if (bio_flagged(bio, BIO_TRACE_COMPLETION)) bio_set_flag(split, BIO_TRACE_COMPLETION);