From patchwork Tue Aug 25 19:47:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ewan Milne X-Patchwork-Id: 7072821 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 269EF9F358 for ; Tue, 25 Aug 2015 19:48:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49A1C205E5 for ; Tue, 25 Aug 2015 19:47:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B9F6205B5 for ; Tue, 25 Aug 2015 19:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753974AbbHYTr5 (ORCPT ); Tue, 25 Aug 2015 15:47:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbbHYTr5 (ORCPT ); Tue, 25 Aug 2015 15:47:57 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id CBA6715775B; Tue, 25 Aug 2015 19:47:56 +0000 (UTC) Received: from emilne.csb (dhcp-25-104.bos.redhat.com [10.18.25.104]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7PJltXX030038; Tue, 25 Aug 2015 15:47:55 -0400 From: "Ewan D. Milne" To: linux-scsi@vger.kernel.org, dgilbert@interlog.com Subject: [PATCH] scsi_debug: fix failure to probe with scsi_level=1 or 2 due to NULL devip Date: Tue, 25 Aug 2015 15:47:54 -0400 Message-Id: <1440532074-28321-1-git-send-email-emilne@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.2 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 From: "Ewan D. Milne" commit cbf67842c3d9 ("scsi_debug: support scsi-mq, queues and locks") added a test for devip == NULL in schedule_resp which returned SCSI_MLQUEUE_HOST_BUSY. Unfortunately, if scsi_level 1 or 2 is specified, devip will be NULL for the INQUIRY command for the next LUN above the configured value and it will be retried indefinitely with an error message. Fix this by returning the command in the same context if no devip exists. Signed-off-by: Ewan D. Milne Acked-by: Douglas Gilbert --- drivers/scsi/scsi_debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 30268bb..25f5cee1 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3944,8 +3944,11 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, struct sdebug_queued_cmd *sqcp = NULL; struct scsi_device *sdp = cmnd->device; - if (NULL == cmnd || NULL == devip) { - pr_warn("%s: called with NULL cmnd or devip pointer\n", + /* devip will be NULL when probing nonexistent LUNs w/o REPORT LUNS */ + if (NULL == devip) + goto respond_in_thread; + if (NULL == cmnd) { + pr_warn("%s: called with NULL cmnd pointer\n", __func__); /* no particularly good error to report back */ return SCSI_MLQUEUE_HOST_BUSY;