]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Client: add functions to test remount functionality
authorGreg Farnum <gfarnum@redhat.com>
Thu, 26 Feb 2015 23:18:31 +0000 (15:18 -0800)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 26 Feb 2015 23:23:21 +0000 (15:23 -0800)
Unprivileged users can't use options when remounting; see
http://tracker.ceph.com/issues/10542. We're about to use this
in ceph-fuse when starting up.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h

index a3a0ce702b6bdce8965ced1dea7e3dfd85ac4991..837b90cfe6ded14a1131c44700e8796ecacedfbd 100644 (file)
@@ -164,6 +164,7 @@ Client::Client(Messenger *m, MonClient *mc)
     ino_invalidate_cb(NULL),
     dentry_invalidate_cb(NULL),
     getgroups_cb(NULL),
+    require_remount(false),
     async_ino_invalidator(m->cct),
     async_dentry_invalidator(m->cct),
     interrupt_finisher(m->cct),
@@ -3449,7 +3450,7 @@ public:
       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) {
+      if (client->require_remount) {
        assert(0 == "failed to remount for kernel dentry trimming");
       }
     }
@@ -7994,6 +7995,24 @@ void Client::ll_register_callbacks(struct client_callback_args *args)
   getgroups_cb = args->getgroups_cb;
 }
 
+int Client::test_remount()
+{
+  int r = 0;
+
+  if (remount_cb) {
+    int s = remount_cb(callback_handle);
+    if (s) {
+      lderr(cct) << "Failed to invoke remount, needed to ensure kernel dcache consistency"
+                << dendl;
+    }
+    if (cct->_conf->client_die_on_failed_remount) {
+      require_remount = true;
+      r = s;
+    }
+  }
+  return r;
+}
+
 int Client::_sync_fs()
 {
   ldout(cct, 10) << "_sync_fs" << dendl;
index d00a4ca909bd98158b5b6c22371ec598e3ac0f22..121d178df80ca5c54aad245e5c0664a947d71014 100644 (file)
@@ -242,6 +242,7 @@ class Client : public Dispatcher {
   client_ino_callback_t ino_invalidate_cb;
   client_dentry_callback_t dentry_invalidate_cb;
   client_getgroups_callback_t getgroups_cb;
+  bool require_remount;
 
   Finisher async_ino_invalidator;
   Finisher async_dentry_invalidator;
@@ -954,6 +955,7 @@ public:
   int ll_osdaddr(int osd, char* buf, size_t size);
 
   void ll_register_callbacks(struct client_callback_args *args);
+  int test_remount();
 };
 
 #endif