/* * The monitor responds with mount ack indicate mount success. The * included client ticket allows the client to talk to MDSs and OSDs. */ static void ceph_monc_handle_map(struct ceph_mon_client *monc, struct ceph_msg *msg) { struct ceph_client *client = monc->client; struct ceph_monmap *monmap = NULL, *old = monc->monmap; void *p, *end; int had_debugfs_info, init_debugfs = 0; mutex_lock(&monc->mutex); had_debugfs_info = have_debugfs_info(monc); dout("handle_monmap\n"); p = msg->front.iov_base; end = p + msg->front.iov_len; monmap = ceph_monmap_decode(p, end); if (IS_ERR(monmap)) { pr_err("problem decoding monmap, %d\n", (int)PTR_ERR(monmap)); goto out; } if (ceph_check_fsid(monc->client, &monmap->fsid) < 0) { kfree(monmap); goto out; } client->monc.monmap = monmap; kfree(old); if (!client->have_fsid) { client->have_fsid = true; if (!had_debugfs_info && have_debugfs_info(monc)) { pr_info("client%lld fsid %pU\n", ceph_client_id(monc->client), &monc->client->fsid); init_debugfs = 1; } mutex_unlock(&monc->mutex); if (init_debugfs) { /* * do debugfs initialization without mutex to avoid * creating a locking dependency */ ceph_debugfs_client_init(monc->client); } goto out_unlocked; } out: mutex_unlock(&monc->mutex); out_unlocked: wake_up_all(&client->auth_wq); }
/* * Initially learn our fsid, or verify an fsid matches. */ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid) { if (client->have_fsid) { if (ceph_fsid_compare(&client->fsid, fsid)) { pr_err("bad fsid, had %pU got %pU", &client->fsid, fsid); return -1; } } else { pr_info("client%lld fsid %pU\n", ceph_client_id(client), fsid); memcpy(&client->fsid, fsid, sizeof(*fsid)); } return 0; }