Skip to contentSkip to conversation

hpsa a few small updates for early July 2014

PATCH Applied Stephen M. Cameron 2 participants 7 messages Jul 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover hpsa a few small updates for early July 2014

Nothing very big here, just a few small updates for now.

I still have a giant ball of patches waiting in the wings, but it is unfortunately not quite ready yet.

---

Robert Elliott (1):
hpsa: do not unconditionally copy sense data

Stephen M. Cameron (4):
hpsa: remove online devices from offline device list
hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl
hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails
hpsa: fix 6-byte READ/WRITE with 0 length data xfer

 drivers/scsi/hpsa.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
Signature · 1 line
-- steve
#1 lore raw

PATCH 1/5 hpsa: remove online devices from offline device list

From: Stephen M. Cameron <[email protected]>

When devices come on line, they should be removed from the list of offline devices that are monitored.

---
 drivers/scsi/hpsa.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +5 -1
index 31184b3..8cd1a9b 100644
@@ -6913,8 +6913,12 @@ static int hpsa_offline_devices_ready(struct ctlr_info *h)
 		d = list_entry(this, struct offline_device_entry,
 				offline_list);
 		spin_unlock_irqrestore(&h->offline_device_lock, flags);
-		if (!hpsa_volume_offline(h, d->scsi3addr))
+		if (!hpsa_volume_offline(h, d->scsi3addr)) {
+			spin_lock_irqsave(&h->offline_device_lock, flags);
+			list_del(&d->offline_list);
+			spin_unlock_irqrestore(&h->offline_device_lock, flags);
 			return 1;
+		}
 		spin_lock_irqsave(&h->offline_device_lock, flags);
 	}
 	spin_unlock_irqrestore(&h->offline_device_lock, flags);
#2 lore raw

PATCH 2/5 hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl

In reply to Stephen M. Cameron

From: Stephen M. Cameron <[email protected]>

When copy_from_user fails, return -EFAULT, not -ENOMEM

---
 drivers/scsi/hpsa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +1 -1
index 8cd1a9b..08b34e9 100644
@@ -5092,7 +5092,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		}
 		if (ioc->Request.Type.Direction & XFER_WRITE) {
 			if (copy_from_user(buff[sg_used], data_ptr, sz)) {
-				status = -ENOMEM;
+				status = -EFAULT;
 				goto cleanup1;
 			}
 		} else
#3 lore raw

PATCH 3/5 hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails

In reply to Stephen M. Cameron

From: Stephen M. Cameron <[email protected]>

---
 drivers/scsi/hpsa.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +3 -1
index 08b34e9..794d726 100644
@@ -6999,8 +6999,10 @@ reinit_after_soft_reset:
 
 	/* Allocate and clear per-cpu variable lockup_detected */
 	h->lockup_detected = alloc_percpu(u32);
-	if (!h->lockup_detected)
+	if (!h->lockup_detected) {
+		rc = -ENOMEM;
 		goto clean1;
+	}
 	set_lockup_detected_for_all_cpus(h, 0);
 
 	rc = hpsa_pci_init(h);
#4 lore raw

PATCH 4/5 hpsa: fix 6-byte READ/WRITE with 0 length data xfer

In reply to Stephen M. Cameron

From: Stephen M. Cameron <[email protected]>

a 6-byte READ/WRITE CDB with a 0 block data transfer really means a 256 block data transfer. The RAID mapping code failed to handle this case. For 10/12/16 byte READ/WRITEs, 0 just means no data should be transferred, and should not trigger BUG_ON.

---
 drivers/scsi/hpsa.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +2 -1
index 794d726..a97a7ff 100644
@@ -3686,6 +3686,8 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
 			(((u64) cmd->cmnd[2]) << 8) |
 			cmd->cmnd[3];
 		block_cnt = cmd->cmnd[4];
+		if (block_cnt == 0)
+			block_cnt = 256;
 		break;
 	case WRITE_10:
 		is_write = 1;
@@ -3734,7 +3736,6 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
 	default:
 		return IO_ACCEL_INELIGIBLE; /* process via normal I/O path */
 	}
-	BUG_ON(block_cnt == 0);
 	last_block = first_block + block_cnt - 1;
 
 	/* check for write to non-RAID-0 */
#5 lore raw

PATCH 5/5 hpsa: do not unconditionally copy sense data

In reply to Stephen M. Cameron

From: Robert Elliott <[email protected]>

---
 drivers/scsi/hpsa.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/scsi/hpsa.c +8 -8
index a97a7ff..f937ea9 100644
@@ -1708,7 +1708,14 @@ static void complete_scsi_command(struct CommandList *cp)
 
 	cmd->result |= ei->ScsiStatus;
 
-	/* copy the sense data whether we need to or not. */
+	scsi_set_resid(cmd, ei->ResidualCnt);
+	if (ei->CommandStatus == 0) {
+		cmd_free(h, cp);
+		cmd->scsi_done(cmd);
+		return;
+	}
+
+	/* copy the sense data */
 	if (SCSI_SENSE_BUFFERSIZE < sizeof(ei->SenseInfo))
 		sense_data_size = SCSI_SENSE_BUFFERSIZE;
 	else
@@ -1717,13 +1724,6 @@ static void complete_scsi_command(struct CommandList *cp)
 		sense_data_size = ei->SenseLen;
 
 	memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
-	scsi_set_resid(cmd, ei->ResidualCnt);
-
-	if (ei->CommandStatus == 0) {
-		cmd_free(h, cp);
-		cmd->scsi_done(cmd);
-		return;
-	}
 
 	/* For I/O accelerator commands, copy over some fields to the normal
 	 * CISS header used below for error handling.