From patchwork Tue Dec 15 08:26:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 67555 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBF8QPjn017184 for ; Tue, 15 Dec 2009 08:26:25 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 8DC9A8E014A; Tue, 15 Dec 2009 03:26:24 -0500 (EST) Received: from int-mx08.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nBF8QNgQ005609 for ; Tue, 15 Dec 2009 03:26:23 -0500 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.7]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBF8QN0g015565 for ; Tue, 15 Dec 2009 03:26:23 -0500 Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBF8Q7lc019513 for ; Tue, 15 Dec 2009 03:26:07 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id DA1B76CB00; Tue, 15 Dec 2009 09:26:06 +0100 (CET) Date: Tue, 15 Dec 2009 09:26:06 +0100 To: James Bottomley User-Agent: Heirloom mailx 12.2 01/07/07 MIME-Version: 1.0 Message-Id: <20091215082606.A45B037AD2@ochil.suse.de> From: hare@suse.de (Hannes Reinecke) X-RedHat-Spam-Score: -5.929 (AWL,RCVD_IN_DNSWL_HI) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.7 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, linux-scsi@vger.kernel.org Subject: [dm-devel] [PATCH] Remove capping from dev_loss_tmo X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 573ce21..6f39bf4 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -475,7 +475,8 @@ MODULE_PARM_DESC(dev_loss_tmo, "Maximum number of seconds that the FC transport should" " insulate the loss of a remote port. Once this value is" " exceeded, the scsi target is removed. Value should be" - " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT."); + " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if" + " fast_io_fail_tmo is not set."); /* * Netlink Infrastructure @@ -831,9 +832,17 @@ store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr, (rport->port_state == FC_PORTSTATE_NOTPRESENT)) return -EBUSY; val = simple_strtoul(buf, &cp, 0); - if ((*cp && (*cp != '\n')) || - (val < 0) || (val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT)) + if ((*cp && (*cp != '\n')) || (val < 0)) return -EINVAL; + + /* + * If fast_io_fail is off we have to cap + * dev_loss_tmo at SCSI_DEVICE_BLOCK_MAX_TIMEOUT + */ + if (rport->fast_io_fail_tmo == -1 && + val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) + return -EINVAL; + i->f->set_rport_dev_loss_tmo(rport, val); return count; } @@ -914,9 +923,16 @@ store_fc_rport_fast_io_fail_tmo(struct device *dev, rport->fast_io_fail_tmo = -1; else { val = simple_strtoul(buf, &cp, 0); - if ((*cp && (*cp != '\n')) || - (val < 0) || (val >= rport->dev_loss_tmo)) + if ((*cp && (*cp != '\n')) || (val < 0)) return -EINVAL; + /* + * Cap fast_io_fail by dev_loss_tmo or + * SCSI_DEVICE_BLOCK_MAX_TIMEOUT. + */ + if ((val >= rport->dev_loss_tmo) || + (val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT)) + return -EINVAL; + rport->fast_io_fail_tmo = val; } return count;