From linux-kernel-owner+willy=40w.ods.org@vger.kernel.org Thu Feb 27 17:22:55 2003 Return-Path: Received: from vax.home.local (vax [10.2.1.2]) by alpha.home.local (8.12.4/8.12.1) with ESMTP id h1RGMsli010705 for ; Thu, 27 Feb 2003 17:22:55 +0100 Received: from vger.kernel.org (vger.kernel.org [209.116.70.75]) by vax.home.local (8.12.2/8.12.1) with ESMTP id h1RGdP1Q006951 for ; Thu, 27 Feb 2003 17:39:29 +0100 (CET) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 27 Feb 2003 11:24:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 27 Feb 2003 11:24:54 -0500 Received: from zmamail02.zma.compaq.com ([161.114.64.102]:43525 "EHLO zmamail02.zma.compaq.com") by vger.kernel.org with ESMTP id ; Thu, 27 Feb 2003 11:24:52 -0500 Received: from zuul.cca.cpqcorp.net (zuul.cca.cpqcorp.net [16.101.176.168]) by zmamail02.zma.compaq.com (Postfix) with ESMTP id 027424C2D; Thu, 27 Feb 2003 11:35:11 -0500 (EST) Received: from zuul.cca.cpqcorp.net (zuul.cca.cpqcorp.net [127.0.0.1]) by zuul.cca.cpqcorp.net (8.12.5/8.12.5) with ESMTP id h1R4bfFm000820; Thu, 27 Feb 2003 10:37:41 +0600 Received: (from root@localhost) by zuul.cca.cpqcorp.net (8.12.5/8.12.5/Submit) id h1R4bf6M000818; Thu, 27 Feb 2003 10:37:41 +0600 Date: Thu, 27 Feb 2003 10:37:41 +0600 From: Stephen Cameron To: linux-kernel@vger.kernel.org Subject: [PATCH] 2.4.21-pre5 cciss fix unlikely startup problem Message-ID: <20030227043741.GA812@zuul.cca.cpqcorp.net> Reply-To: steve.cameron@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org Status: RO Content-Length: 3619 Lines: 98 * Make driver wait longer for board to enter simple mode to handle an unlikely corner case. (If you hot replace a 144 GB failed disk in a RAID 5 set at just the right time prior to driver initialization, the board can take an extra long time to become ready when switched into "simple mode" when the driver is starting up. Without the patch, in those cases, the driver will give up before the board becomes ready, and will not work. (Though rebooting will generally "fix" it). This patch avoids the problem.) * Fix a couple of affected ioctls to return EAGAIN instead of inappropriate EFAULT. --- lx2421p5/drivers/block/cciss.c~cfg_table_wait 2003-02-27 10:11:35.000000000 +0600 +++ lx2421p5-scameron/drivers/block/cciss.c 2003-02-27 10:11:35.000000000 +0600 @@ -94,7 +94,8 @@ static struct board_type products[] = { }; /* How long to wait (in millesconds) for board to go into simple mode */ -#define MAX_CONFIG_WAIT 1000 +#define MAX_CONFIG_WAIT 30000 +#define MAX_IOCTL_CONFIG_WAIT 1000 /*define how many times we will try a command because of bus resets */ #define MAX_CMD_RETRIES 3 @@ -578,7 +579,7 @@ static int cciss_ioctl(struct inode *ino &(c->cfgtable->HostWrite.CoalIntCount)); writel( CFGTBL_ChangeReq, c->vaddr + SA5_DOORBELL); - for(i=0;ivaddr + SA5_DOORBELL) & CFGTBL_ChangeReq)) break; @@ -586,8 +587,11 @@ static int cciss_ioctl(struct inode *ino udelay(1000); } spin_unlock_irqrestore(&io_request_lock, flags); - if (i >= MAX_CONFIG_WAIT) - return -EFAULT; + if (i >= MAX_IOCTL_CONFIG_WAIT) + /* there is an unlikely case where this can happen, + * involving hot replacing a failed 144 GB drive in a + * RAID 5 set just as we attempt this ioctl. */ + return -EAGAIN; return 0; } case CCISS_GETNODENAME: @@ -627,7 +631,7 @@ static int cciss_ioctl(struct inode *ino writel( CFGTBL_ChangeReq, c->vaddr + SA5_DOORBELL); - for(i=0;ivaddr + SA5_DOORBELL) & CFGTBL_ChangeReq)) break; @@ -635,8 +639,11 @@ static int cciss_ioctl(struct inode *ino udelay(1000); } spin_unlock_irqrestore(&io_request_lock, flags); - if (i >= MAX_CONFIG_WAIT) - return -EFAULT; + if (i >= MAX_IOCTL_CONFIG_WAIT) + /* there is an unlikely case where this can happen, + * involving hot replacing a failed 144 GB drive in a + * RAID 5 set just as we attempt this ioctl. */ + return -EAGAIN; return 0; } @@ -2583,11 +2590,17 @@ static int cciss_pci_init(ctlr_info_t *c &(c->cfgtable->HostWrite.TransportRequest)); writel( CFGTBL_ChangeReq, c->vaddr + SA5_DOORBELL); + /* Here, we wait, possibly for a long time, (4 secs or more). + * In some unlikely cases, (e.g. A failed 144 GB drive in a + * RAID 5 set was hot replaced just as we're coming in here) it + * can take that long. Normally (almost always) we will wait + * less than 1 sec. */ for(i=0;ivaddr + SA5_DOORBELL) & CFGTBL_ChangeReq)) break; /* delay and try again */ - udelay(1000); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1); } #ifdef CCISS_DEBUG _ - 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/