summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/secondary.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-09-28 13:19:47 +0000
committerpjd <pjd@FreeBSD.org>2011-09-28 13:19:47 +0000
commit25b3d91c28b6f8cb7542a3071bd1a3179840ab3e (patch)
treece22abe5e22a65f42946679c3d3db98ed7c87678 /sbin/hastd/secondary.c
parent3fbe0df4ff86fa8830e20725cf422207c6873403 (diff)
downloadFreeBSD-src-25b3d91c28b6f8cb7542a3071bd1a3179840ab3e.zip
FreeBSD-src-25b3d91c28b6f8cb7542a3071bd1a3179840ab3e.tar.gz
If the underlying provider doesn't support BIO_FLUSH, log it only once
and don't bother trying in the future. MFC after: 3 days
Diffstat (limited to 'sbin/hastd/secondary.c')
-rw-r--r--sbin/hastd/secondary.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c
index 0ec4c6e..c761143 100644
--- a/sbin/hastd/secondary.c
+++ b/sbin/hastd/secondary.c
@@ -664,7 +664,7 @@ disk_thread(void *arg)
struct hast_resource *res = arg;
struct hio *hio;
ssize_t ret;
- bool clear_activemap;
+ bool clear_activemap, logerror;
clear_activemap = true;
@@ -702,6 +702,7 @@ disk_thread(void *arg)
break;
}
reqlog(LOG_DEBUG, 2, -1, hio, "disk: (%p) Got request: ", hio);
+ logerror = true;
/* Handle the actual request. */
switch (hio->hio_cmd) {
case HIO_READ:
@@ -736,14 +737,23 @@ disk_thread(void *arg)
hio->hio_error = 0;
break;
case HIO_FLUSH:
+ if (!res->hr_localflush) {
+ ret = -1;
+ hio->hio_error = EOPNOTSUPP;
+ logerror = false;
+ break;
+ }
ret = g_flush(res->hr_localfd);
- if (ret < 0)
+ if (ret < 0) {
+ if (errno == EOPNOTSUPP)
+ res->hr_localflush = false;
hio->hio_error = errno;
- else
+ } else {
hio->hio_error = 0;
+ }
break;
}
- if (hio->hio_error != 0) {
+ if (logerror && hio->hio_error != 0) {
reqlog(LOG_ERR, 0, hio->hio_error, hio,
"Request failed: ");
}
OpenPOWER on IntegriCloud