This is a note to let you know that I've just added the patch titled
target: Set peripheral device type consistently in INQUIRY response
to the 3.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
target-set-peripheral-device-type-consistently-in-inquiry-response.patch
and it can be found in the queue-3.3 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 089461dda1770c10fea0b988ff74519a9be81d7e Mon Sep 17 00:00:00 2001
From: Roland Dreier <[email protected]>
Date: Mon, 13 Feb 2012 16:18:15 -0800
Subject: target: Set peripheral device type consistently in INQUIRY response
From: Roland Dreier <[email protected]>
commit 089461dda1770c10fea0b988ff74519a9be81d7e upstream.
Current code sets the peripheral device type to 0x3f == "not present
unknown" for virtual LUN 0 for standard INQUIRY commands, but leaves it
as 0 == "connected direct access block" for VPD INQUIRY commands. This
is just because the check for LUN 0 only happens in some code paths.
Make our peripheral device type consistent by moving the LUN 0 check
into the common emulate_inquiry() code.
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/target/target_core_cdb.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- a/drivers/target/target_core_cdb.c
+++ b/drivers/target/target_core_cdb.c
@@ -70,15 +70,11 @@ target_emulate_inquiry_std(struct se_cmd
{
struct se_lun *lun = cmd->se_lun;
struct se_device *dev = cmd->se_dev;
- struct se_portal_group *tpg = lun->lun_sep->sep_tpg;
- if (dev == tpg->tpg_virt_lun0.lun_se_dev) {
- buf[0] = 0x3f; /* Not connected */
- } else {
- buf[0] = dev->transport->get_device_type(dev);
- if (buf[0] == TYPE_TAPE)
- buf[1] = 0x80;
- }
+ /* Set RMB (removable media) for tape devices */
+ if (dev->transport->get_device_type(dev) == TYPE_TAPE)
+ buf[1] = 0x80;
+
buf[2] = dev->transport->get_device_rev(dev);
/*
@@ -606,6 +602,7 @@ int target_emulate_inquiry(struct se_tas
{
struct se_cmd *cmd = task->task_se_cmd;
struct se_device *dev = cmd->se_dev;
+ struct se_portal_group *tpg = cmd->se_lun->lun_sep->sep_tpg;
unsigned char *buf, *map_buf;
unsigned char *cdb = cmd->t_task_cdb;
int p, ret;
@@ -630,6 +627,11 @@ int target_emulate_inquiry(struct se_tas
buf = map_buf;
}
+ if (dev == tpg->tpg_virt_lun0.lun_se_dev)
+ buf[0] = 0x3f; /* Not connected */
+ else
+ buf[0] = dev->transport->get_device_type(dev);
+
if (!(cdb[1] & 0x1)) {
if (cdb[2]) {
pr_err("INQUIRY with EVPD==0 but PAGE CODE=%02x\n",
@@ -643,8 +645,6 @@ int target_emulate_inquiry(struct se_tas
goto out;
}
- buf[0] = dev->transport->get_device_type(dev);
-
for (p = 0; p < ARRAY_SIZE(evpd_handlers); ++p) {
if (cdb[2] == evpd_handlers[p].page) {
buf[1] = cdb[2];
Patches currently in stable-queue which might be from [email protected] are
queue-3.3/mlx4_core-fix-one-more-static-exported-function.patch
queue-3.3/target-don-t-set-wbus16-or-sync-bits-in-inquiry-response.patch
queue-3.3/target-fix-16-bit-target-ports-for-set-target-port-groups-emulation.patch
queue-3.3/ib-iser-post-initial-receive-buffers-before-sending-the-final-login-request.patch
queue-3.3/tcm_loop-set-residual-field-for-scsi-commands.patch
queue-3.3/target-set-peripheral-device-type-consistently-in-inquiry-response.patch
queue-3.3/target-fix-up-handling-of-short-inquiry-buffers.patch
queue-3.3/iscsi-target-fix-iscsit_alloc_buffs-failure-cases.patch
queue-3.3/ib_srpt-fix-srpt_handle_cmd-send_ioctx-ioctx_kref-leak-on-exception.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html