From: Stefano Garzarella <sgarzare@redhat.com>
To: qemu-devel@nongnu.org
Cc: Mike Christie <michael.christie@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Mark Kanda <mark.kanda@oracle.com>, Fam Zheng <fam@euphon.net>,
Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH 2/3] scsi: cleanup scsi_clear_unit_attention()
Date: Wed, 12 Jul 2023 15:43:51 +0200 [thread overview]
Message-ID: <20230712134352.118655-3-sgarzare@redhat.com> (raw)
In-Reply-To: <20230712134352.118655-1-sgarzare@redhat.com>
The previous commit moved the unit attention clearing when we create
the request. So now we can clean scsi_clear_unit_attention() to handle
only the case of the REPORT LUNS command.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
hw/scsi/scsi-bus.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index f083373021..f9c95dfb50 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -828,26 +828,12 @@ static void scsi_clear_unit_attention(SCSIRequest *req)
return;
}
- if (req->dev->unit_attention.key != UNIT_ATTENTION &&
- req->bus->unit_attention.key != UNIT_ATTENTION) {
- return;
- }
-
- /*
- * If an INQUIRY command enters the enabled command state,
- * the device server shall [not] clear any unit attention condition;
- * See also MMC-6, paragraphs 6.5 and 6.6.2.
- */
- if (req->cmd.buf[0] == INQUIRY ||
- req->cmd.buf[0] == GET_CONFIGURATION ||
- req->cmd.buf[0] == GET_EVENT_STATUS_NOTIFICATION) {
- return;
- }
-
if (req->dev->unit_attention.key == UNIT_ATTENTION) {
ua = &req->dev->unit_attention;
- } else {
+ } else if (req->bus->unit_attention.key == UNIT_ATTENTION) {
ua = &req->bus->unit_attention;
+ } else {
+ return;
}
/*
@@ -856,12 +842,10 @@ static void scsi_clear_unit_attention(SCSIRequest *req)
* with an additional sense code of REPORTED LUNS DATA HAS CHANGED.
*/
if (req->cmd.buf[0] == REPORT_LUNS &&
- !(ua->asc == SENSE_CODE(REPORTED_LUNS_CHANGED).asc &&
- ua->ascq == SENSE_CODE(REPORTED_LUNS_CHANGED).ascq)) {
- return;
+ ua->asc == SENSE_CODE(REPORTED_LUNS_CHANGED).asc &&
+ ua->ascq == SENSE_CODE(REPORTED_LUNS_CHANGED).ascq) {
+ *ua = SENSE_CODE(NO_SENSE);
}
-
- *ua = SENSE_CODE(NO_SENSE);
}
int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len)
--
2.41.0
next prev parent reply other threads:[~2023-07-12 13:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 13:43 [PATCH 0/3] scsi: fix issue with Linux guest and unit attention Stefano Garzarella
2023-07-12 13:43 ` [PATCH 1/3] scsi: fetch unit attention when creating the request Stefano Garzarella
2023-07-12 16:38 ` Paolo Bonzini
2023-07-13 11:43 ` Stefano Garzarella
2024-10-09 16:02 ` Michael Galaxy
2024-10-09 16:28 ` Paolo Bonzini
2024-10-09 18:00 ` Michael Galaxy
2024-10-11 19:44 ` Michael Tokarev
2024-10-23 13:39 ` Michael Galaxy
2023-07-12 13:43 ` Stefano Garzarella [this message]
2023-07-12 13:43 ` [PATCH 3/3] scsi: clear unit attention only for REPORT LUNS commands Stefano Garzarella
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=20230712134352.118655-3-sgarzare@redhat.com \
--to=sgarzare@redhat.com \
--cc=fam@euphon.net \
--cc=mark.kanda@oracle.com \
--cc=michael.christie@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).