Re: [PATCH v2 08/27] hpsa: abandon rescans on memory alloaction failures.

2015-11-09 Thread Hannes Reinecke
On 11/04/2015 10:50 PM, Don Brace wrote:
> Abandon and reschedule rescan process only if device inquiries
> fail due to mem alloc failures, which are likely to occur for
> all devices.
> 
> Otherwise, skip device if inquiry fails for other reasons,
> and continue rescanning process for other devices.
> 
> Reviewed-by: Scott Teel 
> Reviewed-by: Justin Lindley 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Tomas Henzl 
> Signed-off-by: Don Brace 
> ---
>  drivers/scsi/hpsa.c |   24 +++-
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
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 v2 08/27] hpsa: abandon rescans on memory alloaction failures.

2015-11-04 Thread Don Brace
Abandon and reschedule rescan process only if device inquiries
fail due to mem alloc failures, which are likely to occur for
all devices.

Otherwise, skip device if inquiry fails for other reasons,
and continue rescanning process for other devices.

Reviewed-by: Scott Teel 
Reviewed-by: Justin Lindley 
Reviewed-by: Kevin Barnett 
Reviewed-by: Tomas Henzl 
Signed-off-by: Don Brace 
---
 drivers/scsi/hpsa.c |   24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index f010b8e..ce0341a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3366,10 +3366,13 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 
unsigned char *inq_buff;
unsigned char *obdr_sig;
+   int rc = 0;
 
inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
-   if (!inq_buff)
+   if (!inq_buff) {
+   rc = -ENOMEM;
goto bail_out;
+   }
 
/* Do an inquiry to the device to see what it is. */
if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
@@ -3377,6 +3380,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
/* Inquiry failed (msg printed already) */
dev_err(&h->pdev->dev,
"hpsa_update_device_info: inquiry failed\n");
+   rc = -EIO;
goto bail_out;
}
 
@@ -3426,7 +3430,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 
 bail_out:
kfree(inq_buff);
-   return 1;
+   return rc;
 }
 
 static void hpsa_update_device_supports_aborts(struct ctlr_info *h,
@@ -3794,6 +3798,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
n_ext_target_devs = 0;
for (i = 0; i < nphysicals + nlogicals + 1; i++) {
u8 *lunaddrbytes, is_OBDR = 0;
+   int rc = 0;
 
/* Figure out where the LUN ID info is coming from */
lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
@@ -3806,11 +3811,20 @@ static void hpsa_update_scsi_devices(struct ctlr_info 
*h)
continue;
 
/* Get device type, vendor, model, device id */
-   if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
-   &is_OBDR)) {
+   rc = hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
+   &is_OBDR);
+   if (rc == -ENOMEM) {
+   dev_warn(&h->pdev->dev,
+   "Out of memory, rescan deferred.\n");
h->drv_req_rescan = 1;
-   continue; /* skip it if we can't talk to it. */
+   goto out;
}
+   if (rc) {
+   dev_warn(&h->pdev->dev,
+   "Inquiry failed, skipping device.\n");
+   continue;
+   }
+
figure_bus_target_lun(h, lunaddrbytes, tmpdevice);
hpsa_update_device_supports_aborts(h, tmpdevice, lunaddrbytes);
this_device = currentsd[ncurrent];

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