public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Michael Kelley <mikelley@microsoft.com>
Cc: kys@microsoft.com, martin.petersen@oracle.com,
	longli@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	jejb@linux.ibm.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] scsi: storvsc: Fix handling of srb_status and capacity change events
Date: Fri, 11 Nov 2022 23:45:42 +0000	[thread overview]
Message-ID: <Y27epsxr/NAw86QQ@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <1668019722-1983-1-git-send-email-mikelley@microsoft.com>

On Wed, Nov 09, 2022 at 10:48:42AM -0800, Michael Kelley wrote:
> Current handling of the srb_status is incorrect. Commit 52e1b3b3daa9
> ("scsi: storvsc: Correctly handle multiple flags in srb_status")
> is based on srb_status being a set of flags, when in fact only the
> 2 high order bits are flags and the remaining 6 bits are an integer
> status. Because the integer values of interest mostly look like flags,
> the code actually works when treated that way.
> 
> But in the interest of correctness going forward, fix this by treating
> the low 6 bits of srb_status as an integer status code. Add handling
> for SRB_STATUS_INVALID_REQUEST, which was the original intent of commit
> 52e1b3b3daa9. Furthermore, treat the ERROR, ABORTED, and INVALID_REQUEST
> srb status codes as essentially equivalent for the cases we care about.
> There's no harm in doing so, and it isn't always clear which status code
> current or older versions of Hyper-V report for particular conditions.
> 
> Treating the srb status codes as equivalent has the additional benefit
> of ensuring that capacity change events result in an immediate rescan
> so that the new size is known to Linux. Existing code checks SCSI
> sense data for capacity change events when the srb status is ABORTED.
> But capacity change events are also being observed when Hyper-V reports
> the srb status as ERROR. Without the immediate rescan, the new size
> isn't known until something else causes a rescan (such as running
> fdisk to expand a partition), and in the meantime, tools such as "lsblk"
> continue to report the old size.
> 
> Fixes: 52e1b3b3daa9 ("scsi: storvsc: Correctly handle multiple flags in srb_status")
> Reported-by: Juan Tian <juantian@microsoft.com>
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>

Applied to hyperv-fixes. Thanks.

      reply	other threads:[~2022-11-11 23:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 18:48 [PATCH 1/1] scsi: storvsc: Fix handling of srb_status and capacity change events Michael Kelley
2022-11-11 23:45 ` Wei Liu [this message]

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=Y27epsxr/NAw86QQ@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=decui@microsoft.com \
    --cc=jejb@linux.ibm.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=martin.petersen@oracle.com \
    --cc=mikelley@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox