Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755657AbbFOJy7 (ORCPT ); Mon, 15 Jun 2015 05:54:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36799 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755520AbbFOJyv (ORCPT ); Mon, 15 Jun 2015 05:54:51 -0400 Date: Mon, 15 Jun 2015 11:54:49 +0200 From: Johannes Thumshirn To: Sreekanth Reddy Cc: jejb@kernel.org, hch@infradead.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@avagotech.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 15/20] [SCSI] mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command Message-ID: <20150615095449.GH5660@c203.arch.suse.de> References: <1434102153-38581-1-git-send-email-Sreekanth.Reddy@avagotech.com> <1434102153-38581-16-git-send-email-Sreekanth.Reddy@avagotech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1434102153-38581-16-git-send-email-Sreekanth.Reddy@avagotech.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2302 Lines: 58 On Fri, Jun 12, 2015 at 03:12:27PM +0530, Sreekanth Reddy wrote: > scsi_dma_map API will return a negative value (i.e. -ENOMEM) > if DMA mapping of sg lists fails and zero if the sg list in the > SCSI cmd is NULL. But drivers doesn't handled sg list DMA mapping > failure case properly. > > So, Updated the code to return host busy error status to SCSI MID Layer(SML), > when DMA mapping of scatter gather list fails for a SCSI command. > So that SML will retry this SCSI cmd after some time. > > Signed-off-by: Sreekanth Reddy > --- > drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c > index 267e489..0b26c8d 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_base.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c > @@ -1345,7 +1345,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, > > sg_scmd = scsi_sglist(scmd); > sges_left = scsi_dma_map(scmd); > - if (!sges_left) { > + if (!sges_left < 0) { > sdev_printk(KERN_ERR, scmd->device, > "pci_map_sg failed: request for %d bytes!\n", > scsi_bufflen(scmd)); > @@ -1414,7 +1414,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, > fill_in_last_segment: > > /* fill the last segment */ > - while (sges_left) { > + while (sges_left > 0) { > if (sges_left == 1) > _base_add_sg_single_ieee(sg_local, > simple_sgl_flags_last, 0, sg_dma_len(sg_scmd), > -- > 2.0.2 > > -- > 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 Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/