]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: failure injection for cap release
authorJohn Spray <john.spray@redhat.com>
Fri, 5 Sep 2014 12:16:16 +0000 (13:16 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 15 Sep 2014 14:05:13 +0000 (15:05 +0100)
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 <john.spray@redhat.com>
src/client/Client.cc
src/common/config_opts.h

index ae4df676512017f5c92ae995fa2733d343c50fcb..201c989851749c24cba55d97bc8f7999f8f77e9e 100644 (file)
@@ -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;
     }
   }
index 2cd6a04289fb8cbe08a90611839993dba17668f4..8abdb33cea9ca6963a6cafeb9ae647e458560ebc 100644 (file)
@@ -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)