Received: by 10.213.65.68 with SMTP id h4csp3231000imn; Mon, 9 Apr 2018 17:03:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49P679vD0SnHNKw7FtR5lX2kMBfoii5kQYNLZiXa5jCcK92wYYMZjN4wQyqphQl0SoVJ4Z9 X-Received: by 2002:a17:902:7c86:: with SMTP id y6-v6mr3262371pll.378.1523318617371; Mon, 09 Apr 2018 17:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523318617; cv=none; d=google.com; s=arc-20160816; b=Y56t7MuyOjhDGIgR/sHuwPdbHAMUE8Hk//8LPdaBKpD4VrwH57rf8M0ETJwXGjzkrf 27EMKluob9jUumSouwbfsqoItHEUyXJ5oCIg9Z2q5SDbDNNGNvdVP2p6mKPBksqKEXiK y5LlefWDNZPWJYJ8VnfhA06UOWM8ipM0Tyr1SiSOXp9V3JO9SPPKFycjQEEpcYKrgcha zb90XvzTp+lv4qJ2UpJjqcMCkapx0YKJ0pymMb6t9uOmG/Y/RQfWhpMrw3RpRwDNHpRd eTav0DuGTrMqQ4Vr4r7/7k4NuCB3OF5ZXNpVCkoClZvaVpK4e5zqBia79u8dyavOIOdm E3nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=PvwvfnXiFayrjQwJXzCg/Tjk0YttEsL81+V9S1I+vp0=; b=SUTIPmuMRVCJmc2WgMAU9EvYNnVUz9voBYRYtVXMummj58IuTBYU6XvbwCov4NE+1T Ch9LJZhQMNEEPVzmuVIWrJSSmBct8/90gLMf+SQDOQ18qqyXzgxuumD7Xhki8CURT/Ur 5y0eut4TYRKejHhUFLo5zj1At3dlbAEiYopUAywQ7s0Fejgrt7hDBsi3PpjKWMVfXrCu pzheHh56dBqfqRbvoRES3lkRDp5vm7dRJNCzS8oGShWKMBUGkOAbD+n9fXzqZiZVCft4 sx/9z40iANpOQncnRvs1I7grHhqe+WgRNhbqIfwHk3Wi2PnhRZMh3+7W3g9tWq1G4L24 vAtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1-v6si1280826plt.5.2018.04.09.17.02.59; Mon, 09 Apr 2018 17:03:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbeDIXez (ORCPT + 99 others); Mon, 9 Apr 2018 19:34:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35906 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750759AbeDIXex (ORCPT ); Mon, 9 Apr 2018 19:34:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 209D67D843; Mon, 9 Apr 2018 23:34:53 +0000 (UTC) Received: from ming.t460p (ovpn-12-80.pek2.redhat.com [10.72.12.80]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37AF1215CDAF; Mon, 9 Apr 2018 23:34:41 +0000 (UTC) Date: Tue, 10 Apr 2018 07:34:37 +0800 From: Ming Lei To: Bart Van Assche Cc: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "richard.weinberger@gmail.com" , "linux-block@vger.kernel.org" , "wakko@animx.eu.org" Subject: Re: 4.15.14 crash with iscsi target and dvd Message-ID: <20180409233436.GC6450@ming.t460p> References: <20180401163604.GB25011@animx.eu.org> <20180401182723.GA31755@animx.eu.org> <595a10cfb387e6b2ab4d2053b84fed9b3da9e079.camel@wdc.com> <20180406014644.GA16112@animx.eu.org> <20180406020651.GB16112@animx.eu.org> <20180407165335.GA2515@animx.eu.org> <1ff8d234cc565ba9701ce31899fca5faa597e050.camel@wdc.com> <20180408160254.GA22869@animx.eu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 09 Apr 2018 23:34:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 09 Apr 2018 23:34:53 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 09, 2018 at 09:30:11PM +0000, Bart Van Assche wrote: > On Sun, 2018-04-08 at 12:02 -0400, Wakko Warner wrote: > > I finished with git bisect. Here's the output: > > 84c8590646d5b35804bac60eb58b145839b5893e is the first bad commit > > commit 84c8590646d5b35804bac60eb58b145839b5893e > > Author: Ming Lei > > Date: Fri Nov 11 20:05:32 2016 +0800 > > > > target: avoid accessing .bi_vcnt directly > > > > When the bio is full, bio_add_pc_page() will return zero, > > so use this information tell when the bio is full. > > > > Also replace access to .bi_vcnt for pr_debug() with bio_segments(). > > > > Reviewed-by: Christoph Hellwig > > Signed-off-by: Ming Lei > > Reviewed-by: Sagi Grimberg > > Signed-off-by: Jens Axboe > > > > :040000 040000 a3ebbb71c52ee4eb8c3be4d033b81179211bf704 de39a328dbd1b18519946b3ad46d9302886e0dd0 M drivers > > > > I did a diff between HEAD^ and HEAD and manually patched the file from > > 4.15.14. It's not an exact revert. I'm running it now and it's working. > > I'll do a better test later on. Here's the patch: > > > > --- a/drivers/target/target_core_pscsi.c 2018-02-04 14:31:31.077316617 -0500 > > +++ b/drivers/target/target_core_pscsi.c 2018-04-08 11:43:49.588641374 -0400 > > @@ -915,7 +915,9 @@ > > bio, page, bytes, off); > > pr_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n", > > bio_segments(bio), nr_vecs); > > - if (rc != bytes) { > > + if (rc != bytes) > > + goto fail; > > + if (bio->bi_vcnt > nr_vecs) { > > pr_debug("PSCSI: Reached bio->bi_vcnt max:" > > " %d i: %d bio: %p, allocating another" > > " bio\n", bio->bi_vcnt, i, bio); > > Hello Ming, > > Can you have a look at this? The start of this e-mail thread is available at > https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg72574.html. Sure, thanks for your sharing. Wakko, could you test the following patch and see if there is any difference? -- diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 0d99b242e82e..6147178f1f37 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -888,7 +888,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, if (len > 0 && data_len > 0) { bytes = min_t(unsigned int, len, PAGE_SIZE - off); bytes = min(bytes, data_len); - + new_bio: if (!bio) { nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); nr_pages -= nr_vecs; @@ -931,6 +931,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, * be allocated with pscsi_get_bio() above. */ bio = NULL; + goto new_bio; } data_len -= bytes; -- Ming