From: John Spray Date: Fri, 5 Sep 2014 12:16:16 +0000 (+0100) Subject: client: failure injection for cap release X-Git-Tag: v0.86~68^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2b5bbab55c44f93361e667a5ad6f759dd4fdce49;p=ceph.git client: failure injection for cap release Used for simulating a buggy client that trips the error detection in #9282 (warn clients which aren't revoking caps) Signed-off-by: John Spray --- diff --git a/src/client/Client.cc b/src/client/Client.cc index ae4df6765120..201c98985174 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2472,8 +2472,17 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap, << " dropping " << ccap_string(dropping) << dendl; - cap->issued &= retain; - cap->implemented &= cap->issued | used; + if (cct->_conf->client_inject_release_failure && revoking) { + // Simulated bug: + // - tell the server we think issued is whatever they issued plus whatever we implemented + // - leave what we have implemented in place + ldout(cct, 20) << __func__ << " injecting failure to release caps" << dendl; + cap->issued = cap->issued | cap->implemented; + } else { + // Normal behaviour + cap->issued &= retain; + cap->implemented &= cap->issued | used; + } uint64_t flush_tid = 0; snapid_t follows = 0; @@ -4183,7 +4192,12 @@ void Client::flush_cap_releases() p != mds_sessions.end(); ++p) { if (p->second->release && mdsmap->is_clientreplay_or_active_or_stopping(p->first)) { - p->second->con->send_message(p->second->release); + if (cct->_conf->client_inject_release_failure) { + ldout(cct, 20) << __func__ << " injecting failure to send cap release message" << dendl; + p->second->release->put(); + } else { + p->second->con->send_message(p->second->release); + } p->second->release = 0; } } diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 2cd6a04289fb..8abdb33cea9c 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -280,6 +280,7 @@ OPTION(client_oc_max_objects, OPT_INT, 1000) // max objects in cache OPTION(client_debug_force_sync_read, OPT_BOOL, false) // always read synchronously (go to osds) OPTION(client_debug_inject_tick_delay, OPT_INT, 0) // delay the client tick for a number of seconds OPTION(client_max_inline_size, OPT_U64, 4096) +OPTION(client_inject_release_failure, OPT_BOOL, false) // synthetic client bug for testing // note: the max amount of "in flight" dirty data is roughly (max - target) OPTION(fuse_use_invalidate_cb, OPT_BOOL, false) // use fuse 2.8+ invalidate callback to keep page cache consistent OPTION(fuse_allow_other, OPT_BOOL, true)