]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Client: check for failures on system() invocation
authorGreg Farnum <gfarnum@redhat.com>
Tue, 10 Feb 2015 19:11:06 +0000 (11:11 -0800)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 26 Feb 2015 23:23:16 +0000 (15:23 -0800)
Fixes: #10710
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h
src/client/fuse_ll.cc
src/common/config_opts.h

index ef11bdb9b4b52ab67516e44ebed626b16ada94cf..a3a0ce702b6bdce8965ced1dea7e3dfd85ac4991 100644 (file)
@@ -3443,7 +3443,16 @@ private:
 public:
   C_Client_Remount(Client *c) : client(c) {}
   void finish(int r) {
-    client->remount_cb(client->callback_handle);
+    assert (r == 0);
+    r = client->remount_cb(client->callback_handle);
+    if (r != 0) {
+      client_t whoami = client->get_nodeid();
+      lderr(client->cct) << "tried to remount (to trim kernel dentries) and got error "
+                        << r << dendl;
+      if (client->cct->_conf->client_die_on_failed_remount) {
+       assert(0 == "failed to remount for kernel dentry trimming");
+      }
+    }
   }
 };
 
index 0d4bb2cf9f5fef4c4069c818b2cb32d35f1dcd7f..d00a4ca909bd98158b5b6c22371ec598e3ac0f22 100644 (file)
@@ -136,7 +136,7 @@ typedef void (*client_ino_callback_t)(void *handle, vinodeno_t ino, int64_t off,
 
 typedef void (*client_dentry_callback_t)(void *handle, vinodeno_t dirino,
                                         vinodeno_t ino, string& name);
-typedef void (*client_remount_callback_t)(void *handle);
+typedef int (*client_remount_callback_t)(void *handle);
 
 typedef int (*client_getgroups_callback_t)(void *handle, uid_t uid, gid_t **sgids);
 typedef void(*client_switch_interrupt_callback_t)(void *req, void *data);
index 50a9d4879f46026b6f1e5ca045b8452605ae64f0..f9c380c9cb4fde8556fad576baa754bc7654fec3 100644 (file)
@@ -757,14 +757,19 @@ static void dentry_invalidate_cb(void *handle, vinodeno_t dirino,
 #endif
 }
 
-static void remount_cb(void *handle)
+static int remount_cb(void *handle)
 {
   // used for trimming kernel dcache. when remounting a file system, linux kernel
   // trims all unused dentries in the file system
   char cmd[1024];
   CephFuse::Handle *cfuse = (CephFuse::Handle *)handle;
   snprintf(cmd, sizeof(cmd), "mount -i -o remount %s", cfuse->mountpoint);
-  system(cmd);
+  int r = system(cmd);
+  if (r != 0 && r != -1) {
+    r = WEXITSTATUS(r);
+  }
+
+  return r;
 }
 
 static void do_init(void *data, fuse_conn_info *bar)
index 00a23b6b661f2cfeca1375b51eeba178409cd778..38416ae1691e3fc453e6ab02f10f087bf1eb0c19 100644 (file)
@@ -326,6 +326,7 @@ OPTION(fuse_big_writes, OPT_BOOL, true)
 OPTION(fuse_atomic_o_trunc, OPT_BOOL, true)
 OPTION(fuse_debug, OPT_BOOL, false)
 OPTION(fuse_multithreaded, OPT_BOOL, true)
+OPTION(client_die_on_failed_remount, OPT_BOOL, true)
 
 OPTION(crush_location, OPT_STR, "")       // whitespace-separated list of key=value pairs describing crush location