From patchwork Thu Dec 1 13:40:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 9456151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 527FB6074E for ; Thu, 1 Dec 2016 13:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4432F284B7 for ; Thu, 1 Dec 2016 13:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3767E284D3; Thu, 1 Dec 2016 13:41:28 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 BB326284B7 for ; Thu, 1 Dec 2016 13:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755093AbcLANlR (ORCPT ); Thu, 1 Dec 2016 08:41:17 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:38617 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754600AbcLANlQ (ORCPT ); Thu, 1 Dec 2016 08:41:16 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uB1DeaKI011095 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Dec 2016 13:40:36 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uB1DeZgf024306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Dec 2016 13:40:35 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id uB1DeXZm016714; Thu, 1 Dec 2016 13:40:34 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Dec 2016 05:40:33 -0800 To: Christoph Hellwig Cc: "Ewan D. Milne" , Johannes Thumshirn , Laurence Oberman , Eyal Ben David , dgilbert@interlog.com, linux-scsi@vger.kernel.org Subject: Re: SG does not ignore dxferp (direct io + mmap) From: "Martin K. Petersen" Organization: Oracle Corporation References: <1479752642.19792.43.camel@localhost.localdomain> <20161122083759.xeifuex3xxfimuwz@linux-x5ow.site> <1479839407.28416.21.camel@localhost.localdomain> <2146476957.2165908.1479927335303.JavaMail.zimbra@redhat.com> <1479932524.28416.43.camel@localhost.localdomain> <20161125080758.5bh5jkcgvhw3xuvb@linux-x5ow.site> <1194718949.74785.1480096576577.JavaMail.zimbra@redhat.com> <1480523188.28416.94.camel@localhost.localdomain> Date: Thu, 01 Dec 2016 08:40:31 -0500 In-Reply-To: <1480523188.28416.94.camel@localhost.localdomain> (Ewan D. Milne's message of "Wed, 30 Nov 2016 11:26:28 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP >>>>> "Ewan" == Ewan D Milne writes: >> I think what we need to understand is what caused the regression in >> the first place, I probably should have been bisecting the original >> failure rather than trying to find where it started working. Ewan> Bisecting leads to this commit: commit 37f19e57a0de3c4a3417aa13ff4d04f1e0dee4b3 Author: Christoph Hellwig Date: Sun Jan 18 16:16:33 2015 +0100 block: merge __bio_map_user_iov into bio_map_user_iov And also remove the unused bdev argument. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Signed-off-by: Jens Axboe Specifically, the problem appears to be caused by the removal of the setting of bio->bi_bdev, which would previously be set to NULL. If I add: /* Ewan> The test passes (no zero byte corruption). Ewan> Setting dxferp would cause map_data.null_mapped to be set before Ewan> it is passed to blk_rq_map_user(_iov) which would cause a Ewan> difference in behavior. Christoph? Acked-by: Christoph Hellwig diff --git a/block/bio.c b/block/bio.c index 0723d4c..ecac37b 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1351,6 +1351,7 @@ struct bio *bio_map_user_iov(struct request_queue *q, if (iter->type & WRITE) bio->bi_rw |= REQ_WRITE; + bio->bi_bdev = NULL; bio->bi_flags |= (1 << BIO_USER_MAPPED);