From patchwork Tue Apr 28 21:24:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 6292271 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 95F219F326 for ; Tue, 28 Apr 2015 21:24:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6C97202B4 for ; Tue, 28 Apr 2015 21:24:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7ADB20266 for ; Tue, 28 Apr 2015 21:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966026AbbD1VYM (ORCPT ); Tue, 28 Apr 2015 17:24:12 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:34266 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965999AbbD1VYM (ORCPT ); Tue, 28 Apr 2015 17:24:12 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id C297F8EE1C5; Tue, 28 Apr 2015 14:24:11 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rCw1goU3U5OZ; Tue, 28 Apr 2015 14:24:11 -0700 (PDT) Received: from [153.66.254.242] (unknown [50.46.149.214]) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 6C4618EE0FB; Tue, 28 Apr 2015 14:24:11 -0700 (PDT) Message-ID: <1430256250.2181.17.camel@HansenPartnership.com> Subject: [PATCH] scsi_scan: fix queue depth initialisation problem From: James Bottomley To: linux-scsi Cc: Hannes Reinecke Date: Tue, 28 Apr 2015 14:24:10 -0700 X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: James Bottomley Date: Sun, 26 Apr 2015 11:52:46 -0700 Subject: [PATCH] scsi_scan: fix queue depth initialisation problem Currently we blindly use the value of cmd_per_lun as the initial setting for queue_depth. This fails miserably (hangs the system) if it is zero, which is the default value for anything uninitialised in the template. The net result is that every host template has to set a value for cmd_per_lun. Instead, use a default value of 1 if the actual value is unset. This should pave the way for removing cmd_per_lun from all the templates and eventually from SCSI itself. Signed-off-by: James Bottomley Tested-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 60aae01..681a59a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -280,7 +280,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, sdev->host->cmd_per_lun, shost->bqt, shost->hostt->tag_alloc_policy); } - scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun); + scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun ? + sdev->host->cmd_per_lun : 1); scsi_sysfs_device_initialize(sdev);