Received: by 10.192.165.156 with SMTP id m28csp1766346imm; Thu, 12 Apr 2018 03:11:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vTwcGsmqcpHEJQLkikt45i/RxvOFA2i7WbDhhZSbx68w9/EzNn+Vhs4i16+snR3cG17IP X-Received: by 10.98.155.12 with SMTP id r12mr7081935pfd.15.1523527885849; Thu, 12 Apr 2018 03:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523527885; cv=none; d=google.com; s=arc-20160816; b=SADpPKMLkFHgQr5IFwWbZPyQHAItjw1u0dzTCWLzuCNcQZO8kDVwiy7Gf7zGBjLf6T 1PgBmvB6LNQHm2QDJfiLW/W5BG4xibfEg1LoA/JKyYlgdwAm5MMe4mOEp6sko0R8aAFs BYPGqxwqaO6Kkha6d8DcfpPef0OLhjHxXaQZ0cyK9DHWCjTIH4H8W8VS81Il0h5nb3JC LN10sUZdBAPwcB6bAvTg85IIJPjuFMWAwwjVK+yLpWAflEbb54giqcRsPM0DKa+cSqa9 A1Qo2VRd7cInB+2rY5tw5HlWATZejBCLo5N+N5Kuy1zB9TbrGPBHtYO/xv95E99YRw5d EBhw== 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=ZnQbiVlZqZZzUtylw5InHhHBeM1vKE7rZn/exEZgjX8=; b=wu89ZwS/tZgDjhhIYd5ofFvNLT2Y/PVRAZtbwGOFD2VgoHu9lF8wFJUW44sNU79gZS avJ5hfhBANQANTMb1TYo5Q1sHX5gSe74xCY3J0z3Wtxu8NMF3W8gOHw0DJw3u901b1W7 dYaqs+ZveY0eGjAnpfxVjSMBSBuVUuzb5zMD0asvOADx2jC58k5GZbwAezEIYMDWM7eu J4pBq9U5FA8zQRYqVUguHV5JDhKp9troaarSNMOObxwVl2vzGiApY4XX1PaESvWRaGNx /F+eKBMizShywkSCSTQJxnpXhQ9AwOHGz3g7t6JHP3KK9BThmWG8T+BSLNroW9WXPl5d LSFQ== 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 b14si2094577pge.252.2018.04.12.03.10.48; Thu, 12 Apr 2018 03:11:25 -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 S1752396AbeDLKIK (ORCPT + 99 others); Thu, 12 Apr 2018 06:08:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751854AbeDLKII (ORCPT ); Thu, 12 Apr 2018 06:08:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2246340201A7; Thu, 12 Apr 2018 10:08:08 +0000 (UTC) Received: from ming.t460p (ovpn-12-28.pek2.redhat.com [10.72.12.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB0431102E22; Thu, 12 Apr 2018 10:07:56 +0000 (UTC) Date: Thu, 12 Apr 2018 18:07:52 +0800 From: Ming Lei To: Wakko Warner Cc: Bart Van Assche , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "richard.weinberger@gmail.com" , "linux-block@vger.kernel.org" Subject: Re: 4.15.14 crash with iscsi target and dvd Message-ID: <20180412100751.GB4697@ming.t460p> References: <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> <20180409233436.GC6450@ming.t460p> <20180411004525.GA9107@animx.eu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180411004525.GA9107@animx.eu.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 12 Apr 2018 10:08:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 12 Apr 2018 10:08:08 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 Tue, Apr 10, 2018 at 08:45:25PM -0400, Wakko Warner wrote: > Ming Lei wrote: > > 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; > > Sorry for the delay. I reverted my change, added this one. I didn't > reboot, I just unloaded and loaded this one. > Note: /dev/sr1 as seen from the initiator is /dev/sr0 (physical disc) on the > target. > > Doesn't crash, however on the initiator I see this: > [9273849.707777] ISO 9660 Extensions: RRIP_1991A > [9273863.359718] scsi_io_completion: 13 callbacks suppressed > [9273863.359788] sr 26:0:0:0: [sr1] tag#1 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08 > [9273863.359909] sr 26:0:0:0: [sr1] tag#1 Sense Key : 0x2 [current] > [9273863.359974] sr 26:0:0:0: [sr1] tag#1 ASC=0x8 ASCQ=0x0 > [9273863.360036] sr 26:0:0:0: [sr1] tag#1 CDB: opcode=0x28 28 00 00 22 f6 96 00 00 80 00 > [9273863.360116] blk_update_request: 13 callbacks suppressed > [9273863.360177] blk_update_request: I/O error, dev sr1, sector 9165400 > [9273875.864648] sr 26:0:0:0: [sr1] tag#1 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08 > [9273875.864738] sr 26:0:0:0: [sr1] tag#1 Sense Key : 0x2 [current] > [9273875.864801] sr 26:0:0:0: [sr1] tag#1 ASC=0x8 ASCQ=0x0 > [9273875.864890] sr 26:0:0:0: [sr1] tag#1 CDB: opcode=0x28 28 00 00 22 f7 16 00 00 80 00 > [9273875.864971] blk_update_request: I/O error, dev sr1, sector 9165912 > > To cause this, I mounted the dvd as seen in the first line and ran this > command: find /cdrom2 -type f | xargs -tn1 cat > /dev/null > I did some various tests. Each test was done after umount and mount to > clear the cache. > cat > /dev/null causes the message. > dd if= of=/dev/null bs=2048 doesn't > using bs=4096 doesn't > using bs=64k doesn't > using bs=128k does > cat uses a blocksize of 128k. > > The following was done without being mounted. > ddrescue -f -f /dev/sr1 /dev/null > doesn't cause the message > dd if=/dev/sr1 of=/dev/null bs=128k > doesn't cause the message > using bs=256k causes the message once: > [9275916.857409] sr 27:0:0:0: [sr1] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08 > [9275916.857482] sr 27:0:0:0: [sr1] tag#0 Sense Key : 0x2 [current] > [9275916.857520] sr 27:0:0:0: [sr1] tag#0 ASC=0x8 ASCQ=0x0 > [9275916.857556] sr 27:0:0:0: [sr1] tag#0 CDB: opcode=0x28 28 00 00 00 00 00 00 00 80 00 > [9275916.857614] blk_update_request: I/O error, dev sr1, sector 0 > > If I access the disc from the target natively either by mounting and > accessing files or working with the device directly (ie dd) no errors are > logged on the target. OK, thanks for your test. Could you test the following patch and see if there is still the failure message? diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 0d99b242e82e..6137287b52fb 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -913,9 +913,11 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, rc = bio_add_pc_page(pdv->pdv_sd->request_queue, bio, page, bytes, off); + if (rc != bytes) + goto fail; pr_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n", bio_segments(bio), nr_vecs); - if (rc != bytes) { + if (/*rc != bytes*/0) { pr_debug("PSCSI: Reached bio->bi_vcnt max:" " %d i: %d bio: %p, allocating another" " bio\n", bio->bi_vcnt, i, bio); -- Ming