dout(30, "monmap_decode %p %p len %d\n", p, end, (int)(end-p));
- /* the encoded and decoded sizes match. */
+ /* The encoded and decoded sizes match. */
m = kmalloc(end-p, GFP_NOFS);
if (m == NULL)
return ERR_PTR(-ENOMEM);
ceph_decode_need(&p, end, 2*sizeof(__u32) + 2*sizeof(__u64), bad);
- ceph_decode_32(&p, m->epoch);
ceph_decode_64_le(&p, m->fsid.major);
ceph_decode_64_le(&p, m->fsid.minor);
+ ceph_decode_32(&p, m->epoch);
ceph_decode_32(&p, m->num_mon);
ceph_decode_need(&p, end, m->num_mon*sizeof(m->mon_inst[0]), bad);
ceph_decode_copy(&p, m->mon_inst, m->num_mon*sizeof(m->mon_inst[0]));
/* don't bother if forced unmount */
if (client->mount_state == CEPH_MOUNT_SHUTDOWN)
return;
+
mutex_lock(&monc->req_mutex);
monc->umount_delay = BASE_DELAY_INTERVAL;
do_request_umount(&monc->umount_delayed_work.work);
if (monc->monmap == NULL)
return -ENOMEM;
spin_lock_init(&monc->statfs_lock);
- mutex_init(&monc->req_mutex);
INIT_RADIX_TREE(&monc->statfs_request_tree, GFP_ATOMIC);
+ monc->last_tid = 0;
INIT_DELAYED_WORK(&monc->mds_delayed_work, do_request_mdsmap);
INIT_DELAYED_WORK(&monc->osd_delayed_work, do_request_osdmap);
INIT_DELAYED_WORK(&monc->umount_delayed_work, do_request_umount);
- monc->last_tid = 0;
+ monc->mds_delay = monc->osd_delay = monc->umount_delay = 0;
+ mutex_init(&monc->req_mutex);
monc->want_mdsmap = 0;
monc->want_osdmap = 0;
return 0;
extern int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl);
extern void ceph_monc_stop(struct ceph_mon_client *monc);
+/*
+ * The model here is to indicate that we need a new map of at least epoch
+ * @want, and to indicate which maps receive. Periodically rerequest the map
+ * from the monitor cluster until we get what we want.
+ */
extern void ceph_monc_request_mdsmap(struct ceph_mon_client *monc, __u32 want);
extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, __u32 have);
extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, __u32 have);
extern void ceph_monc_request_umount(struct ceph_mon_client *monc);
-extern void ceph_monc_report_failure(struct ceph_mon_client *monc,
- struct ceph_entity_inst *who);
extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
struct ceph_statfs *buf);
mon_inst.push_back(inst);
}
- /*
- int add(const char *a) {
- entity_addr_t addr;
- if (!parse_ip_port(a, addr))
- return -EINVAL;
- if (contains(addr))
- return -EEXIST;
- add(addr);
- }
- */
void add(entity_addr_t a) {
entity_inst_t i;
i.addr = a;
}
void encode(bufferlist& blist) {
- ::encode(epoch, blist);
::encode_raw(fsid, blist);
+ ::encode(epoch, blist);
::encode(mon_inst, blist);
}
void decode(bufferlist& blist) {
decode(p);
}
void decode(bufferlist::iterator &p) {
- ::decode(epoch, p);
::decode_raw(fsid, p);
+ ::decode(epoch, p);
::decode(mon_inst, p);
}