return statfs(0, stbuf, perms);
}
-void Client::ll_register_callbacks(struct ceph_client_callback_args *args)
+void Client::_ll_register_callbacks(struct ceph_client_callback_args *args)
{
if (!args)
return;
- std::scoped_lock l(client_lock);
+
ldout(cct, 10) << __func__ << " cb " << args->handle
<< " invalidate_ino_cb " << args->ino_cb
<< " invalidate_dentry_cb " << args->dentry_cb
umask_cb = args->umask_cb;
}
+// This is deprecated, use ll_register_callbacks2() instead.
+void Client::ll_register_callbacks(struct ceph_client_callback_args *args)
+{
+ ceph_assert(!is_mounting() && !is_mounted() && !is_unmounting());
+
+ _ll_register_callbacks(args);
+}
+
+int Client::ll_register_callbacks2(struct ceph_client_callback_args *args)
+{
+ if (is_mounting() || is_mounted() || is_unmounting())
+ return -CEPHFS_EBUSY;
+
+ _ll_register_callbacks(args);
+ return 0;
+}
+
int Client::test_dentry_handling(bool can_invalidate)
{
int r = 0;
int ll_osdaddr(int osd, uint32_t *addr);
int ll_osdaddr(int osd, char* buf, size_t size);
- void ll_register_callbacks(struct ceph_client_callback_args *args);
+ void _ll_register_callbacks(struct ceph_client_callback_args *args);
+ void ll_register_callbacks(struct ceph_client_callback_args *args); // deprecated
+ int ll_register_callbacks2(struct ceph_client_callback_args *args);
int test_dentry_handling(bool can_invalidate);
const char** get_tracked_conf_keys() const override;
ceph_assert(args.allocated); // Checking fuse has realloc'd args so we can free newargv
free(newargv);
+
+ struct ceph_client_callback_args cb_args = {
+ handle: this,
+ ino_cb: client->cct->_conf.get_val<bool>("fuse_use_invalidate_cb") ?
+ ino_invalidate_cb : NULL,
+ dentry_cb: dentry_invalidate_cb,
+ switch_intr_cb: switch_interrupt_cb,
+#if defined(__linux__)
+ remount_cb: remount_cb,
+#endif
+#if !defined(__APPLE__)
+ umask_cb: umask_cb,
+#endif
+ };
+ r = client->ll_register_callbacks2(&cb_args);
+ if (r) {
+ derr << "registering callbacks failed: " << r << dendl;
+ return r;
+ }
+
return 0;
}
fuse_session_add_chan(se, ch);
#endif
-
- struct ceph_client_callback_args args = {
- handle: this,
- ino_cb: client->cct->_conf.get_val<bool>("fuse_use_invalidate_cb") ?
- ino_invalidate_cb : NULL,
- dentry_cb: dentry_invalidate_cb,
- switch_intr_cb: switch_interrupt_cb,
-#if defined(__linux__)
- remount_cb: remount_cb,
-#endif
-#if !defined(__APPLE__)
- umask_cb: umask_cb,
-#endif
- };
- client->ll_register_callbacks(&args);
-
return 0;
}
#define LIBCEPHFS_VER_MAJOR 10
#define LIBCEPHFS_VER_MINOR 0
-#define LIBCEPHFS_VER_EXTRA 2
+#define LIBCEPHFS_VER_EXTRA 3
#define LIBCEPHFS_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
#define LIBCEPHFS_VERSION_CODE LIBCEPHFS_VERSION(LIBCEPHFS_VER_MAJOR, LIBCEPHFS_VER_MINOR, LIBCEPHFS_VER_EXTRA)
/**
* Register a set of callbacks to be used with this cmount
+ *
+ * This is deprecated, use ceph_ll_register_callbacks2() instead.
+ *
* @param cmount the ceph mount handle on which the cb's should be registerd
* @param args callback arguments to register with the cmount
*
void ceph_ll_register_callbacks(struct ceph_mount_info *cmount,
struct ceph_client_callback_args *args);
+/**
+ * Register a set of callbacks to be used with this cmount
+ * @param cmount the ceph mount handle on which the cb's should be registerd
+ * @param args callback arguments to register with the cmount
+ *
+ * Any fields set to NULL will be ignored. There currently is no way to
+ * unregister these callbacks, so this is a one-way change.
+ *
+ * Returns 0 on success or -EBUSY if the cmount is mounting or already mounted.
+ */
+int ceph_ll_register_callbacks2(struct ceph_mount_info *cmount,
+ struct ceph_client_callback_args *args);
+
/**
* Get snapshot info
*
cmount->get_client()->finish_reclaim();
}
+// This is deprecated, use ceph_ll_register_callbacks2 instead.
extern "C" void ceph_ll_register_callbacks(class ceph_mount_info *cmount,
struct ceph_client_callback_args *args)
{
cmount->get_client()->ll_register_callbacks(args);
+}
+extern "C" int ceph_ll_register_callbacks2(class ceph_mount_info *cmount,
+ struct ceph_client_callback_args *args)
+{
+ return cmount->get_client()->ll_register_callbacks2(args);
}
struct ceph_client_callback_args args = { 0 };
args.ino_release_cb = cb;
- ceph_ll_register_callbacks(cmount, &args);
+ ret = ceph_ll_register_callbacks2(cmount, &args);
+ assert(ret == 0);
ret = ceph_mount(cmount, NULL);
assert(ret >= 0);