// start up fuse
// use my argc, argv (make sure you pass a mount point!)
- r = client->mount(g_conf->client_mountpoint.c_str());
+ r = client->mount(g_conf->client_mountpoint.c_str(), g_ceph_context->_conf->fuse_require_active_mds);
if (r < 0) {
+ if (r == CEPH_FUSE_NO_MDS_UP)
+ cerr << "ceph-fuse[" << getpid() << "]: probably no MDS server is up?" << std::endl;
cerr << "ceph-fuse[" << getpid() << "]: ceph mount failed with " << cpp_strerror(-r) << std::endl;
goto out_shutdown;
}
// -------------------
// MOUNT
-int Client::mount(const std::string &mount_root)
+int Client::mount(const std::string &mount_root, bool require_mds)
{
Mutex::Locker lock(client_lock);
tick(); // start tick
ldout(cct, 2) << "mounted: have mdsmap " << mdsmap->get_epoch() << dendl;
+ if (require_mds) {
+ while (1) {
+ if (mdsmap->get_epoch() > 0) {
+ if (mdsmap->get_num_mds(CEPH_MDS_STATE_ACTIVE) == 0) {
+ ldout(cct, 10) << "no mds up: epoch=" << mdsmap->get_epoch() << dendl;
+ return CEPH_FUSE_NO_MDS_UP;
+ } else {
+ break;
+ }
+ } else {
+ wait_on_list(waiting_for_mdsmap);
+ }
+ }
+ }
// hack: get+pin root inode.
// fuse assumes it's always there.
void _release_filelocks(Fh *fh);
void _update_lock_state(struct flock *fl, uint64_t owner, ceph_lock_state_t *lock_state);
public:
- int mount(const std::string &mount_root);
+ int mount(const std::string &mount_root, bool require_mds=false);
void unmount();
int mds_command(