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");
+ }
+ }
}
};
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);
#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)
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