From patchwork Sat Nov 21 16:56:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 7674691 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE369BF90C for ; Sat, 21 Nov 2015 16:58:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D96C92066D for ; Sat, 21 Nov 2015 16:58:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9B5D2066A for ; Sat, 21 Nov 2015 16:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbbKUQ52 (ORCPT ); Sat, 21 Nov 2015 11:57:28 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51638 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbbKUQ51 convert rfc822-to-8bit (ORCPT ); Sat, 21 Nov 2015 11:57:27 -0500 Received: from [103.192.227.7] (helo=tom-T450) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1a0BTJ-00047S-4O; Sat, 21 Nov 2015 16:57:09 +0000 Date: Sun, 22 Nov 2015 00:56:35 +0800 From: Ming Lei To: Laurent Dufour Cc: Michael Ellerman , Christoph Hellwig , Mark Salter , "James E. J. Bottomley" , brking , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-block@vger.kernel.org, tom.leiming@gmail.com Subject: Re: kernel BUG at drivers/scsi/scsi_lib.c:1096! Message-ID: <20151122005635.1b9ffbe1@tom-T450> In-Reply-To: <565055C6.5040801@linux.vnet.ibm.com> References: <1447838334.1564.2.camel@ellerman.id.au> <1447855399.3974.24.camel@redhat.com> <1447894964.15206.0.camel@ellerman.id.au> <20151119082325.GA11419@infradead.org> <1448021448.14769.7.camel@ellerman.id.au> <565055C6.5040801@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, 21 Nov 2015 12:30:14 +0100 Laurent Dufour wrote: > On 20/11/2015 13:10, Michael Ellerman wrote: > > On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote: > > > >> It's pretty much guaranteed a block layer bug, most likely in the > >> merge bios to request infrastucture where we don't obey the merging > >> limits properly. > >> > >> Does either of you have a known good and first known bad kernel? > > > > Not me, I've only hit it one or two times. All I can say is I have hit it in > > 4.4-rc1. > > > > Laurent, can you narrow it down at all? > > It seems that the panic is triggered by the commit bdced438acd8 ("block: > setup bi_phys_segments after splitting") which has been pulled by the > merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of > git://git.kernel.dk/linux-block"). > > My system is panicing promptly when running a kernel built at > d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours > without panicing. > > This being said, I can't explain what's going wrong. > > May Ming shed some light here ? Laurent, looks there is one bug in blk_bio_segment_split(), would you mind testing the following patch to see if it fixes your issue? --- From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 22 Nov 2015 00:47:13 +0800 Subject: [PATCH] block: fix segment split Inside blk_bio_segment_split(), previous bvec pointer('bvprvp') always points to the iterator local variable, which is obviously wrong, so fix it by pointing to the local variable of 'bvprv'. Signed-off-by: Ming Lei --- block/blk-merge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index de5716d8..f2efe8a 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -98,7 +98,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, seg_size += bv.bv_len; bvprv = bv; - bvprvp = &bv; + bvprvp = &bvprv; sectors += bv.bv_len >> 9; continue; } @@ -108,7 +108,7 @@ new_segment: nsegs++; bvprv = bv; - bvprvp = &bv; + bvprvp = &bvprv; seg_size = bv.bv_len; sectors += bv.bv_len >> 9; }