public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] hpsa a few small updates for early July 2014
@ 2014-07-03 15:17 Stephen M. Cameron
  2014-07-03 15:17 ` [PATCH 1/5] hpsa: remove online devices from offline device list Stephen M. Cameron
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:17 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

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(-)

-- 
-- steve


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] hpsa: remove online devices from offline device list
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
@ 2014-07-03 15:17 ` Stephen M. Cameron
  2014-07-03 15:18 ` [PATCH 2/5] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl Stephen M. Cameron
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:17 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

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

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
---
 drivers/scsi/hpsa.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 31184b3..8cd1a9b 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
  2014-07-03 15:17 ` [PATCH 1/5] hpsa: remove online devices from offline device list Stephen M. Cameron
@ 2014-07-03 15:18 ` Stephen M. Cameron
  2014-07-03 15:18 ` [PATCH 3/5] hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails Stephen M. Cameron
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:18 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

When copy_from_user fails, return -EFAULT, not -ENOMEM

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reported-by: Robert Elliott <elliott@hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
Cc: <stable@vger.kernel.org>
---
 drivers/scsi/hpsa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8cd1a9b..08b34e9 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
  2014-07-03 15:17 ` [PATCH 1/5] hpsa: remove online devices from offline device list Stephen M. Cameron
  2014-07-03 15:18 ` [PATCH 2/5] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl Stephen M. Cameron
@ 2014-07-03 15:18 ` Stephen M. Cameron
  2014-07-03 15:18 ` [PATCH 4/5] hpsa: fix 6-byte READ/WRITE with 0 length data xfer Stephen M. Cameron
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:18 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
---
 drivers/scsi/hpsa.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 08b34e9..794d726 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] hpsa: fix 6-byte READ/WRITE with 0 length data xfer
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
                   ` (2 preceding siblings ...)
  2014-07-03 15:18 ` [PATCH 3/5] hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails Stephen M. Cameron
@ 2014-07-03 15:18 ` Stephen M. Cameron
  2014-07-03 15:18 ` [PATCH 5/5] hpsa: do not unconditionally copy sense data Stephen M. Cameron
  2014-07-03 17:31 ` [PATCH 0/5] hpsa a few small updates for early July 2014 Christoph Hellwig
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:18 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

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.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reported-by: Robert Elliott <elliott@hp.com>
Reviewed-by: Robert Elliott <elliott@hp.com>
---
 drivers/scsi/hpsa.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 794d726..a97a7ff 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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 */


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] hpsa: do not unconditionally copy sense data
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
                   ` (3 preceding siblings ...)
  2014-07-03 15:18 ` [PATCH 4/5] hpsa: fix 6-byte READ/WRITE with 0 length data xfer Stephen M. Cameron
@ 2014-07-03 15:18 ` Stephen M. Cameron
  2014-07-03 17:31 ` [PATCH 0/5] hpsa a few small updates for early July 2014 Christoph Hellwig
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen M. Cameron @ 2014-07-03 15:18 UTC (permalink / raw)
  To: james.bottomley
  Cc: martin.petersen, linux-scsi, stephenmcameron, joseph.t.handzik,
	thenzl, michael.miller, elliott, scott.teel, hch

From: Robert Elliott <elliott@hp.com>

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a97a7ff..f937ea9 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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.


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] hpsa a few small updates for early July 2014
  2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
                   ` (4 preceding siblings ...)
  2014-07-03 15:18 ` [PATCH 5/5] hpsa: do not unconditionally copy sense data Stephen M. Cameron
@ 2014-07-03 17:31 ` Christoph Hellwig
  5 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2014-07-03 17:31 UTC (permalink / raw)
  To: Stephen M. Cameron
  Cc: james.bottomley, martin.petersen, linux-scsi, stephenmcameron,
	joseph.t.handzik, thenzl, michael.miller, elliott, scott.teel,
	hch

Thanks Stephen,

applied to the for 3.17 queue.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-03 17:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
2014-07-03 15:17 ` [PATCH 1/5] hpsa: remove online devices from offline device list Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 2/5] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 3/5] hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 4/5] hpsa: fix 6-byte READ/WRITE with 0 length data xfer Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 5/5] hpsa: do not unconditionally copy sense data Stephen M. Cameron
2014-07-03 17:31 ` [PATCH 0/5] hpsa a few small updates for early July 2014 Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox