This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch 7.0.x in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit 7ab269cc245b0da6c78da5e187ea2ad2b1b8365b Author: Gancho Tenev <[email protected]> AuthorDate: Thu Sep 15 06:44:44 2016 -0700 TS-4870: Avoid marking storage offline multiple times Added a CacheDisk:online flag because we cannot relay on DISK_BAD(disk) macro to identify if we already marked it bad. The problem is that in the common use-case in handle_disk_failure(), the disk is already bad when mark_storage_offline() is called, so we can't depend on the good->bad state transition to know when to update the accounting. (cherry picked from commit 7421eabf0f74da0005c25cc199b79f28ff5159de) --- iocore/cache/Cache.cc | 9 ++++++++- iocore/cache/P_CacheDisk.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index e4c5676..9562808 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -2000,6 +2000,13 @@ CacheProcessor::mark_storage_offline(CacheDisk *d ///< Target disk uint64_t total_dir_delete = 0; uint64_t used_dir_delete = 0; + /* Don't mark it again, it will invalidate the stats! */ + if (!d->online) { + return this->has_online_storage(); + } + + d->online = false; + if (!DISK_BAD(d)) SET_DISK_BAD(d); @@ -2052,7 +2059,7 @@ CacheProcessor::has_online_storage() const { CacheDisk **dptr = gdisks; for (int disk_no = 0; disk_no < gndisks; ++disk_no, ++dptr) { - if (!DISK_BAD(*dptr)) + if (!DISK_BAD(*dptr) && (*dptr)->online) return true; } return false; diff --git a/iocore/cache/P_CacheDisk.h b/iocore/cache/P_CacheDisk.h index b391625..8d631e8 100644 --- a/iocore/cache/P_CacheDisk.h +++ b/iocore/cache/P_CacheDisk.h @@ -97,6 +97,7 @@ struct CacheDisk : public Continuation { int num_errors; int cleared; bool read_only_p; + bool online; /* flag marking cache disk online or offline (because of too many failures or by the operator). */ // Extra configuration values int forced_volume_num; ///< Volume number for this disk. @@ -119,6 +120,7 @@ struct CacheDisk : public Continuation { num_errors(0), cleared(0), read_only_p(false), + online(true), forced_volume_num(-1) { } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
