From patchwork Wed Nov 4 21:50:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 7554031 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 81DDE9F2F7 for ; Wed, 4 Nov 2015 21:54:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BE8F20604 for ; Wed, 4 Nov 2015 21:54:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91E4F205E7 for ; Wed, 4 Nov 2015 21:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030399AbbKDVyh (ORCPT ); Wed, 4 Nov 2015 16:54:37 -0500 Received: from bby1mta02.pmc-sierra.com ([216.241.235.117]:60753 "EHLO bby1mta02.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030228AbbKDVyg (ORCPT ); Wed, 4 Nov 2015 16:54:36 -0500 Received: from bby1mta02.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id 2E7C88E04FD; Wed, 4 Nov 2015 13:54:36 -0800 (PST) Received: from bby1uinfra02-temp.pmc-sierra.bc.ca (bby1uinfra02-temp.pmc-sierra.bc.ca [216.241.226.204]) by bby1mta02.pmc-sierra.bc.ca (Postfix) with ESMTP id 051B28E04DD; Wed, 4 Nov 2015 13:54:36 -0800 (PST) Received: from [127.0.1.1] (kirk.hou.lab.pmc-sierra.bc.ca [10.238.32.34]) by bby1uinfra02-temp.pmc-sierra.bc.ca (Postfix) with ESMTP id 5CD37E06DF; Wed, 4 Nov 2015 13:54:35 -0800 (PST) Subject: [PATCH v2 08/27] hpsa: abandon rescans on memory alloaction failures. From: Don Brace To: scott.teel@pmcs.com, Kevin.Barnett@pmcs.com, scott.benesh@pmcs.com, james.bottomley@parallels.com, hch@infradead.org, Justin.Lindley@pmcs.com, elliott@hpe.com Cc: linux-scsi@vger.kernel.org Date: Wed, 04 Nov 2015 15:50:44 -0600 Message-ID: <20151104215044.15472.82408.stgit@brunhilda> In-Reply-To: <20151104214910.15472.23179.stgit@brunhilda> References: <20151104214910.15472.23179.stgit@brunhilda> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=subject:from:to:cc:date:message-id:in-reply-to:references:mime-version:content-type:content-transfer-encoding; s=default; bh=k42P/hZRA2a09u5Lp2j3sTbw3Js/Y3pwNnSMz+SDH/s=; b=X3qZpmyq1UV+Zgznf9Lrl7EbHO0kQKysPEwEs/dWtRvLSIoOqak31mOUUhiV9GrrxH0L5txi++IpuN2VIuSbVeQp7rk0vnMG8dDYZr8Jel7nmpjegIyMCUnr6nhYGgPCC6+/aH46xSzEfKtfiTSkawa0xA1jwC8pjj3ej5oz8j4= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Hannes Reinecke --- drivers/scsi/hpsa.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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];