From patchwork Sat Jan 9 05:51:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 7991841 Return-Path: X-Original-To: patchwork-linux-scsi@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 24A02BEEE5 for ; Sat, 9 Jan 2016 04:17:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56BFE201ED for ; Sat, 9 Jan 2016 04:17:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 790B0201EC for ; Sat, 9 Jan 2016 04:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752494AbcAIERX (ORCPT ); Fri, 8 Jan 2016 23:17:23 -0500 Received: from p3plsmtps2ded04.prod.phx3.secureserver.net ([208.109.80.198]:57970 "EHLO p3plsmtps2ded04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752348AbcAIEQr (ORCPT ); Fri, 8 Jan 2016 23:16:47 -0500 Received: from linuxonhyperv.com ([72.167.245.219]) by : HOSTING RELAY : with SMTP id HkxKaVPXHWOsdHkxKahRmc; Fri, 08 Jan 2016 21:16:46 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id 79920190332; Fri, 8 Jan 2016 21:52:00 -0800 (PST) From: "K. Y. Srinivasan" To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, ohering@suse.com, jbottomley@parallels.com, hch@infradead.org, linux-scsi@vger.kernel.org, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, martin.petersen@oracle.com, hare@suse.de Cc: "K. Y. Srinivasan" Subject: [PATCH 2/2] scsi: storvsc: Use the specified target ID in device lookup Date: Fri, 8 Jan 2016 21:51:59 -0800 Message-Id: <1452318719-25490-2-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1452318719-25490-1-git-send-email-kys@microsoft.com> References: <1452318697-25451-1-git-send-email-kys@microsoft.com> <1452318719-25490-1-git-send-email-kys@microsoft.com> X-CMAE-Envelope: MS4wfGq4zwCWnP5kmNIGklz7AzSfyEAYMH2gXUfBHi9E5B9M70IVfWgcE/XzLX/A8r3MB4mGq+Wdgt3CDGHEl7x0YVd594VPy99nej4UazqrrMiwF5Ig0XmM ATKqDN62Dq1YD2iqVqBf7BhkZ4FqMEwhyXY3ONkKRWcmphtZj/K4l0/rqwvQb7ZNuQSINQO7nqB1A1h3IPgT8gsqEyNLbtGTT6YMGOyOoEDOjpbj0V3GnwEh cIVDwkEAVzmHhKzM7BIxfbtTZU1Ta9MS+0d/JhtagWYY5uVG6UqR+16a853Z5NIcnqLNcD4EGqd+Qdn4mOWiNMaWzoBroj5YirXPAOnnObK2v6TQ6Iu/imfT rbs7WVRvYT2G8creJ5/kPGHXg9Vd3PlmKZOT6ZTIBuHGMucbIYw627pkhBBlt3CKavYpJWJMriv9q04f1XjudUfTW5cyXp8gN2BkAbD+GxJwznNxQpVdcteY eocrkVGfXxHG+a4RiQuObpwtU+FWqEtgox/82vtH5QGqX+hsaFvmfIK4OrUk8wMgHTjkW7JDsDGx/crFQ+CUK0MxgyQ7yJLytr3wu0oeTM7+IfxZA7NV8kaX XDQ= 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, 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 The current code assumes that there is only one target in device lookup. Fix this bug. This will alow us to correctly handle hot reomoval of LUNs. Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 622f64a..5faf357 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -479,6 +479,7 @@ struct storvsc_scan_work { struct work_struct work; struct Scsi_Host *host; uint lun; + uint tgt_id; }; static void storvsc_device_scan(struct work_struct *work) @@ -490,7 +491,7 @@ static void storvsc_device_scan(struct work_struct *work) wrk = container_of(work, struct storvsc_scan_work, work); lun = wrk->lun; - sdev = scsi_device_lookup(wrk->host, 0, 0, lun); + sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, lun); if (!sdev) goto done; scsi_rescan_device(&sdev->sdev_gendev); @@ -541,7 +542,7 @@ static void storvsc_remove_lun(struct work_struct *work) if (!scsi_host_get(wrk->host)) goto done; - sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun); + sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk->lun); if (sdev) { scsi_remove_device(sdev); @@ -941,6 +942,7 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, wrk->host = host; wrk->lun = vm_srb->lun; + wrk->tgt_id = vm_srb->target_id; INIT_WORK(&wrk->work, process_err_fn); schedule_work(&wrk->work); }