From owner-svn-src-head@FreeBSD.ORG Tue Feb 17 23:20:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 631F9106566C; Tue, 17 Feb 2009 23:20:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51E9B8FC14; Tue, 17 Feb 2009 23:20:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1HNK6lX030605; Tue, 17 Feb 2009 23:20:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1HNK6RF030604; Tue, 17 Feb 2009 23:20:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200902172320.n1HNK6RF030604@svn.freebsd.org> From: Alexander Motin Date: Tue, 17 Feb 2009 23:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188740 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2009 23:20:06 -0000 Author: mav Date: Tue Feb 17 23:20:04 2009 New Revision: 188740 URL: http://svn.freebsd.org/changeset/base/188740 Log: Adaptively increase control command timeout when drive is spun down. This should fix, for example, cache flush timeout error on shutdown, if some drives are not mounted. PR: kern/111023 Modified: head/sys/dev/ata/ata-queue.c Modified: head/sys/dev/ata/ata-queue.c ============================================================================== --- head/sys/dev/ata/ata-queue.c Tue Feb 17 22:49:58 2009 (r188739) +++ head/sys/dev/ata/ata-queue.c Tue Feb 17 23:20:04 2009 (r188740) @@ -119,6 +119,7 @@ int ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature, u_int64_t lba, u_int16_t count) { + struct ata_device *atadev = device_get_softc(dev); struct ata_request *request = ata_alloc_request(); int error = ENOMEM; @@ -129,7 +130,13 @@ ata_controlcmd(device_t dev, u_int8_t co request->u.ata.count = count; request->u.ata.feature = feature; request->flags = ATA_R_CONTROL; - request->timeout = 1; + if (atadev->spindown_state) { + device_printf(dev, "request while spun down, starting.\n"); + atadev->spindown_state = 0; + request->timeout = 31; + } else { + request->timeout = 5; + } request->retries = 0; ata_queue_request(request); error = request->result;