Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2009 22:01:16 -0500
From:      "James R. Van Artsdalen" <james-freebsd-current@jrv.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: ata FLUSHCACHE timeout errors? [patch]
Message-ID:  <49E69F7C.9020402@jrv.org>
In-Reply-To: <49E4CED7.2040206@jrv.org>
References:  <49E4CED7.2040206@jrv.org>

next in thread | previous in thread | raw e-mail | index | archive | help
James R. Van Artsdalen wrote:
> I am getting many FLUSHCACHE timeout errors during "zfs recv" operations.

This patch fixes this. PR to be filed.
In addition this causes any ata request that times out to print the
timeout, since it's going to be the timeout itself that's likely wrong.

A five-second timeout is used in the ATA code unless the disk is known
to be spun down.  This is almost certainly wrong as the ATA spec allows
devices to take up to 30 seconds.  Nonetheless I only changed the
FLUSHCACHE case that was failing.

Index: sys/dev/ata/ata-queue.c
===================================================================
--- sys/dev/ata/ata-queue.c     (revision 190917)
+++ sys/dev/ata/ata-queue.c     (working copy)
@@ -134,6 +134,8 @@
            device_printf(dev, "request while spun down, starting.\n");
            atadev->spindown_state = 0;
            request->timeout = 31;
+       } else if (command == ATA_FLUSHCACHE || command ==
ATA_FLUSHCACHE48) {
+           request->timeout = 31;
        } else {
            request->timeout = 5;
        }
@@ -295,9 +297,9 @@
            (request->retries-- > 0)) {
            if (!(request->flags & ATA_R_QUIET)) {
                device_printf(request->dev,
-                             "TIMEOUT - %s retrying (%d retr%s left)",
+                             "TIMEOUT - %s retrying (%d retr%s left)
timeout %d",
                              ata_cmd2str(request), request->retries,
-                             request->retries == 1 ? "y" : "ies");
+                             request->retries == 1 ? "y" : "ies",
request->timeout);
                if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL)))
                    printf(" LBA=%ju", request->u.ata.lba);
                printf("\n");
Index: sys/dev/ata/ata-disk.c
===================================================================
--- sys/dev/ata/ata-disk.c      (revision 190917)
+++ sys/dev/ata/ata-disk.c      (working copy)
@@ -263,8 +263,9 @@
        device_printf(dev, "request while spun down, starting.\n");
        atadev->spindown_state = 0;
        request->timeout = 31;
-    }
-    else {
+    } else if (bp->bio_cmd == BIO_FLUSH) {
+       request->timeout = 31;
+    } else {
        request->timeout = 5;
     }
     request->retries = 2;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49E69F7C.9020402>