From: James Bottomley <jejb@linux.vnet.ibm.com>
To: KY Srinivasan <kys@microsoft.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de>,
Jens Axboe <axboe@kernel.dk>,
Linus Torvalds <torvalds@linux-foundation.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>,
Josh Poulson <jopoulso@microsoft.com>,
"Adrian Suhov (Cloudbase Solutions SRL)" <v-adsuho@microsoft.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Haiyang Zhang <haiyangz@microsoft.com>
Subject: Re: [RFC] hv_storvsc: error handling.
Date: Sat, 04 Mar 2017 13:36:59 -0800 [thread overview]
Message-ID: <1488663419.2985.4.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <DM5PR03MB24906E9B50B16B8C567EE25BA02A0@DM5PR03MB2490.namprd03.prod.outlook.com>
On Sat, 2017-03-04 at 21:03 +0000, KY Srinivasan wrote:
>
> > -----Original Message-----
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Friday, March 3, 2017 4:50 PM
> > To: James Bottomley <James.Bottomley@Hansenpartnership.com>
> > Cc: Hannes Reinecke <hare@suse.de>; Christoph Hellwig <hch@lst.de>;
> > James Bottomley <jejb@linux.vnet.ibm.com>; Jens Axboe
> > <axboe@kernel.dk>; Linus Torvalds <torvalds@linux-foundation.org>;
> > Martin K. Petersen <martin.petersen@oracle.com>; KY Srinivasan
> > <kys@microsoft.com>; Dexuan Cui <decui@microsoft.com>; Long Li
> > <longli@microsoft.com>; Josh Poulson <jopoulso@microsoft.com>;
> > Adrian
> > Suhov (Cloudbase Solutions SRL) <v-adsuho@microsoft.com>; linux-
> > scsi@vger.kernel.org; Haiyang Zhang <haiyangz@microsoft.com>
> > Subject: [RFC] hv_storvsc: error handling.
> >
> > Needs more testing but this does fix the observed problem.
> >
> > From: Stephen Hemminger <sthemmin@microsoft.com>
> >
> > Subject: [PATCH] hv_storvsc: fix error handling
> >
> > The Hyper-V storvsc SCSI driver was hiding all errors in INQUIRY
> > and
> > MODE_SENSE commands. This caused the scan process to incorrectly
> > think
> > devices were present and online. Also invalid LUN errors were not
> > being handled correctly.
> >
> > This fixes problems booting a GEN2 VM on Hyper-V. It effectively
> > reverts commit 4ed51a21c0f69 ("Staging: hv: storvsc: Fixup
> > srb and scsi status for INQUIRY and MODE_SENSE")
> >
> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> > ---
> > drivers/scsi/storvsc_drv.c | 48 ++++------------------------------
> > ------------
> > 1 file changed, 4 insertions(+), 44 deletions(-)
> >
> > diff --git a/drivers/scsi/storvsc_drv.c
> > b/drivers/scsi/storvsc_drv.c
> > index 638e5f427c90..8cc241fc54b8 100644
> > --- a/drivers/scsi/storvsc_drv.c
> > +++ b/drivers/scsi/storvsc_drv.c
> > @@ -543,28 +543,6 @@ static void storvsc_host_scan(struct
> > work_struct
> > *work)
> > kfree(wrk);
> > }
> >
> > -static void storvsc_remove_lun(struct work_struct *work)
> > -{
> > - struct storvsc_scan_work *wrk;
> > - struct scsi_device *sdev;
> > -
> > - wrk = container_of(work, struct storvsc_scan_work, work);
> > - if (!scsi_host_get(wrk->host))
> > - goto done;
> > -
> > - sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk
> > ->lun);
> > -
> > - if (sdev) {
> > - scsi_remove_device(sdev);
> > - scsi_device_put(sdev);
> > - }
> > - scsi_host_put(wrk->host);
> > -
> > -done:
> > - kfree(wrk);
> > -}
> > -
> > -
> > /*
> > * We can get incoming messages from the host that are not in
> > response to
> > * messages that we have sent out. An example of this would be
> > messages
> > @@ -955,8 +933,7 @@ static void storvsc_handle_error(struct
> > vmscsi_request *vm_srb,
> > }
> > break;
> > case SRB_STATUS_INVALID_LUN:
> > - do_work = true;
> > - process_err_fn = storvsc_remove_lun;
> > + set_host_byte(scmnd, DID_NO_CONNECT);
> > break;
> > case SRB_STATUS_ABORTED:
> > if (vm_srb->srb_status &
> > SRB_STATUS_AUTOSENSE_VALID
> > &&
> > @@ -1050,32 +1027,15 @@ static void storvsc_on_io_completion(struct
> > storvsc_device *stor_device,
> >
> > stor_pkt = &request->vstor_packet;
> >
> > - /*
> > - * The current SCSI handling on the host side does
> > - * not correctly handle:
> > - * INQUIRY command with page code parameter set to 0x80
> > - * MODE_SENSE command with cmd[2] == 0x1c
> > - *
> > - * Setup srb and scsi status so this won't be fatal.
> > - * We do this so we can distinguish truly fatal failues
> > - * (srb status == 0x4) and off-line the device in that
> > case.
> > - */
> > -
> > - if ((stor_pkt->vm_srb.cdb[0] == INQUIRY) ||
> > - (stor_pkt->vm_srb.cdb[0] == MODE_SENSE)) {
> > - vstor_packet->vm_srb.scsi_status = 0;
> > - vstor_packet->vm_srb.srb_status =
> > SRB_STATUS_SUCCESS;
> > - }
> > -
> > -
> > /* Copy over the status...etc */
> > stor_pkt->vm_srb.scsi_status = vstor_packet
> > ->vm_srb.scsi_status;
> > stor_pkt->vm_srb.srb_status = vstor_packet
> > ->vm_srb.srb_status;
> > stor_pkt->vm_srb.sense_info_length =
> > vstor_packet->vm_srb.sense_info_length;
> >
> > - if (vstor_packet->vm_srb.scsi_status != 0 ||
> > - vstor_packet->vm_srb.srb_status != SRB_STATUS_SUCCESS)
> > + if (stor_pkt->vm_srb.cdb[0] != INQUIRY &&
> > + (vstor_packet->vm_srb.scsi_status != 0 ||
> > + vstor_packet->vm_srb.srb_status !=
> > SRB_STATUS_SUCCESS))
> > storvsc_log(device, STORVSC_LOGGING_WARN,
> > "cmd 0x%x scsi status 0x%x srb status
> > 0x%x\n",
> > stor_pkt->vm_srb.cdb[0],
> > --
>
> This patch gets rid of the ability to "hot remove" LUNs. I don't
> think that can be part of any
> solution. The INQUIRY hack I put in a long time ago was to deal with
> host bugs on prior versions of
> Windows server. WS2016 should not be trigerring this code. Stephen,
> could you please test this patch -
> a quick hack:
>
> From b97f24f224a71a6e745c42e5640045a553eb407c Mon Sep 17 00:00:00
> 2001
> From: K. Y. Srinivasan <kys@microsoft.com>
> Date: Sat, 4 Mar 2017 14:00:46 -0700
> Subject: [PATCH 1/1] scsi: storvsc: Fix a bug in LUN removal code
> Reply-To: kys@microsoft.com
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> drivers/scsi/storvsc_drv.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> index 05526b7..27eb682 100644
> --- a/drivers/scsi/storvsc_drv.c
> +++ b/drivers/scsi/storvsc_drv.c
> @@ -885,6 +885,7 @@ static void storvsc_handle_error(struct
> vmscsi_request *vm_srb,
> struct storvsc_scan_work *wrk;
> void (*process_err_fn)(struct work_struct *work);
> bool do_work = false;
> + struct scsi_device *sdev;
>
> switch (SRB_STATUS(vm_srb->srb_status)) {
> case SRB_STATUS_ERROR:
> @@ -911,6 +912,18 @@ static void storvsc_handle_error(struct
> vmscsi_request *vm_srb,
> }
> break;
> case SRB_STATUS_INVALID_LUN:
> + if (!scsi_host_get(host)) {
> + set_host_byte(scmnd, DID_NO_CONNECT);
> + break;
> + }
> +
> + sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id,
> wrk->lun);
> +
> + if (!sdev) {
> + set_host_byte(scmnd, DID_NO_CONNECT);
> + break;
> + }
> +
You're now getting two references (one to the host and one to the
device) that you don't put either in error handling or in
storvsc_remove_lun().
Probably you should eliminate the scsi_host_get and scsi_device_lookup
in storvsc_remove_lun() (making it basically remove device put device
put host) and add a host put in the !sdev if above.
James
next prev parent reply other threads:[~2017-03-04 21:37 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 23:30 SCSI regression in 4.11 Stephen Hemminger
2017-02-28 1:19 ` Stephen Hemminger
2017-02-28 2:16 ` Jens Axboe
2017-02-28 14:08 ` Christoph Hellwig
2017-02-28 15:32 ` Jens Axboe
2017-02-28 17:06 ` James Bottomley
2017-02-28 17:16 ` Stephen Hemminger
2017-02-28 17:31 ` Jens Axboe
2017-02-28 18:41 ` Stephen Hemminger
2017-02-28 19:10 ` James Bottomley
2017-02-28 18:57 ` Stephen Hemminger
2017-02-28 23:48 ` James Bottomley
2017-03-01 1:25 ` Stephen Hemminger
2017-03-01 6:20 ` James Bottomley
2017-03-01 6:48 ` Stephen Hemminger
2017-03-01 15:50 ` Christoph Hellwig
2017-03-01 15:54 ` Stephen Hemminger
2017-03-02 0:01 ` Christoph Hellwig
2017-03-02 0:56 ` Christoph Hellwig
2017-03-02 1:40 ` Stephen Hemminger
2017-03-02 13:25 ` Hannes Reinecke
2017-03-02 17:48 ` Stephen Hemminger
2017-03-02 18:23 ` Stephen Hemminger
2017-03-02 18:36 ` James Bottomley
2017-03-02 19:05 ` Stephen Hemminger
2017-03-02 19:18 ` James Bottomley
2017-03-03 22:29 ` Stephen Hemminger
2017-03-04 0:50 ` [RFC] hv_storvsc: error handling Stephen Hemminger
2017-03-04 11:55 ` Hannes Reinecke
2017-03-04 21:03 ` KY Srinivasan
2017-03-04 21:36 ` James Bottomley [this message]
2017-03-04 21:39 ` KY Srinivasan
2017-03-04 23:55 ` KY Srinivasan
2017-03-06 16:36 ` Stephen Hemminger
2017-03-06 17:48 ` KY Srinivasan
2017-03-06 17:57 ` Stephen Hemminger
2017-03-07 5:06 ` Christoph Hellwig
2017-03-07 6:08 ` KY Srinivasan
2017-03-02 0:57 ` SCSI regression in 4.11 Stephen Hemminger
2017-03-01 16:13 ` Stephen Hemminger
2017-03-01 18:48 ` Stephen Hemminger
2017-03-01 18:57 ` James Bottomley
2017-03-01 19:20 ` James Bottomley
2017-03-01 19:39 ` Stephen Hemminger
2017-03-01 21:27 ` Stephen Hemminger
2017-03-01 23:09 ` James Bottomley
2017-03-01 23:39 ` Stephen Hemminger
2017-03-01 19:00 ` Linus Torvalds
2017-02-28 17:33 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488663419.2985.4.camel@linux.vnet.ibm.com \
--to=jejb@linux.vnet.ibm.com \
--cc=axboe@kernel.dk \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jopoulso@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-scsi@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=martin.petersen@oracle.com \
--cc=stephen@networkplumber.org \
--cc=torvalds@linux-foundation.org \
--cc=v-adsuho@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.