コード例 #1
0
ファイル: mon_client.c プロジェクト: JonnyH/pandora-kernel
/*
 * 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;

	mutex_lock(&monc->mutex);

	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);

out:
	mutex_unlock(&monc->mutex);
	wake_up_all(&client->auth_wq);
}
コード例 #2
0
ファイル: mon_client.c プロジェクト: AdrianHuang/linux-3.8.13
/*
 * 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);
}