You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ok...@apache.org on 2018/03/03 11:17:21 UTC
[trafficserver] branch master updated: fix unpredictable diskok
within CacheProcessor::start_internal
This is an automated email from the ASF dual-hosted git repository.
oknet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 30107ba fix unpredictable diskok within CacheProcessor::start_internal
30107ba is described below
commit 30107ba960772d892e64d05c331dbbffbbcf4250
Author: Oknet Xu <xu...@skyguard.com.cn>
AuthorDate: Fri Mar 2 17:52:34 2018 +0800
fix unpredictable diskok within CacheProcessor::start_internal
---
iocore/cache/Cache.cc | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index e464e19..f38a589 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -607,7 +607,6 @@ CacheProcessor::start_internal(int flags)
fix = !!(flags & PROCESSOR_FIX);
check = (flags & PROCESSOR_CHECK) != 0;
start_done = 0;
- int diskok = 1;
Span *sd;
/* read the config file and create the data structures corresponding
@@ -652,22 +651,22 @@ CacheProcessor::start_internal(int flags)
}
if (fd >= 0) {
+ bool diskok = true;
if (!sd->file_pathname) {
if (!check) {
if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) {
Warning("unable to truncate cache file '%s' to %" PRId64 " blocks", path, blocks);
- diskok = 0;
+ diskok = false;
}
} else { // read-only mode checks
struct stat sbuf;
- diskok = 0;
if (-1 == fstat(fd, &sbuf)) {
fprintf(stderr, "Failed to stat cache file for directory %s\n", path);
+ diskok = false;
} else if (blocks != sbuf.st_size / STORE_BLOCK_SIZE) {
fprintf(stderr, "Cache file for directory %s is %" PRId64 " bytes, expected %" PRId64 "\n", path, sbuf.st_size,
blocks * static_cast<int64_t>(STORE_BLOCK_SIZE));
- } else {
- diskok = 1;
+ diskok = false;
}
}
}
--
To stop receiving notification emails like this one, please contact
oknet@apache.org.