RE: [PATCH] hpsa: correct logical resets

2016-11-15 Thread Don Brace
> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Monday, November 14, 2016 5:44 PM
> To: Don Brace
> Cc: j...@linux.vnet.ibm.com; John Hall; Kevin Barnett; Mahesh
> Rajashekhara; Bader Ali-saleh; h...@infradead.org; Scott Teel; Viswas G;
> Justin Lindley; Scott Benesh; elli...@hpe.com; posw...@suse.com; linux-
> s...@vger.kernel.org
> Subject: Re: [PATCH] hpsa: correct logical resets
> 
> EXTERNAL EMAIL
> 
> 
> >>>>> "Don" == Don Brace <don.br...@microsemi.com> writes:
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 0b6eb5a..a296537 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -300,6 +300,10 @@ static bool hpsa_cmd_dev_match(struct ctlr_info *h,
> struct CommandList *c,
>struct hpsa_scsi_dev_t *dev,
>unsigned char *scsi3addr);
> 
> +static int wait_for_device_to_become_ready(struct ctlr_info *h,
> +  unsigned char lunaddr[],
> +  int reply_queue);
> +
>  static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
>  {
> unsigned long *priv = shost_priv(sdev->host);
> 
> Wouldn't it be nicer to put this with the rest of the function
> prototypes at the beginning of the file?
> 
> --
> Martin K. Petersen  Oracle Linux Engineering

Ok, I can move it up above
static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
 int wait_for_ready);

Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hpsa: correct logical resets

2016-11-14 Thread Martin K. Petersen
> "Don" == Don Brace  writes:

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0b6eb5a..a296537 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -300,6 +300,10 @@ static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct 
CommandList *c,
   struct hpsa_scsi_dev_t *dev,
   unsigned char *scsi3addr);
 
+static int wait_for_device_to_become_ready(struct ctlr_info *h,
+  unsigned char lunaddr[],
+  int reply_queue);
+
 static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
 {
unsigned long *priv = shost_priv(sdev->host);

Wouldn't it be nicer to put this with the rest of the function
prototypes at the beginning of the file?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] hpsa: correct logical resets

2016-11-10 Thread Don Brace
- driver was not calling done in some cases which causes
  the volume to be offlined.
- avoid doing rescan during a reset.

Reviewed-by: Scott Teel 
Reviewed-by: Kevin Barnett 
Signed-off-by: Don Brace 
---
 drivers/scsi/hpsa.c |   24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0b6eb5a..a296537 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -300,6 +300,10 @@ static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct 
CommandList *c,
   struct hpsa_scsi_dev_t *dev,
   unsigned char *scsi3addr);
 
+static int wait_for_device_to_become_ready(struct ctlr_info *h,
+  unsigned char lunaddr[],
+  int reply_queue);
+
 static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
 {
unsigned long *priv = shost_priv(sdev->host);
@@ -2540,7 +2544,7 @@ static void complete_scsi_command(struct CommandList *cp)
 
if ((unlikely(hpsa_is_pending_event(cp {
if (cp->reset_pending)
-   return hpsa_cmd_resolve_and_free(h, cp);
+   return hpsa_cmd_free_and_done(h, cp, cmd);
if (cp->abort_pending)
return hpsa_cmd_abort_and_free(h, cp, cmd);
}
@@ -3079,6 +3083,8 @@ static int hpsa_do_reset(struct ctlr_info *h, struct 
hpsa_scsi_dev_t *dev,
 
if (unlikely(rc))
atomic_set(>reset_cmds_out, 0);
+   else
+   wait_for_device_to_become_ready(h, scsi3addr, 0);
 
mutex_unlock(>reset_mutex);
return rc;
@@ -5563,6 +5569,14 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
if (unlikely(lockup_detected(h)))
return hpsa_scan_complete(h);
 
+   /*
+* Do the scan after a reset completion
+*/
+   if (h->reset_in_progress) {
+   h->drv_req_rescan = 1;
+   return;
+   }
+
hpsa_update_scsi_devices(h);
 
hpsa_scan_complete(h);
@@ -8641,6 +8655,14 @@ static void hpsa_rescan_ctlr_worker(struct work_struct 
*work)
if (h->remove_in_progress)
return;
 
+   /*
+* Do the scan after the reset
+*/
+   if (h->reset_in_progress) {
+   h->drv_req_rescan = 1;
+   return;
+   }
+
if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) {
scsi_host_get(h->scsi_host);
hpsa_ack_ctlr_events(h);

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html