Release 4.11 net/ceph/mon_client.c
#include <linux/ceph/ceph_debug.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/sched.h>
#include <linux/ceph/mon_client.h>
#include <linux/ceph/libceph.h>
#include <linux/ceph/debugfs.h>
#include <linux/ceph/decode.h>
#include <linux/ceph/auth.h>
/*
* Interact with Ceph monitor cluster. Handle requests for new map
* versions, and periodically resend as needed. Also implement
* statfs() and umount().
*
* A small cluster of Ceph "monitors" are responsible for managing critical
* cluster configuration and state information. An odd number (e.g., 3, 5)
* of cmon daemons use a modified version of the Paxos part-time parliament
* algorithm to manage the MDS map (mds cluster membership), OSD map, and
* list of clients who have mounted the file system.
*
* We maintain an open, active session with a monitor at all times in order to
* receive timely MDSMap updates. We periodically send a keepalive byte on the
* TCP socket to ensure we detect a failure. If the connection does break, we
* randomly hunt for a new monitor. Once the connection is reestablished, we
* resend any outstanding requests.
*/
static const struct ceph_connection_operations mon_con_ops;
static int __validate_auth(struct ceph_mon_client *monc);
/*
* Decode a monmap blob (e.g., during mount).
*/
struct ceph_monmap *ceph_monmap_decode(void *p, void *end)
{
struct ceph_monmap *m = NULL;
int i, err = -EINVAL;
struct ceph_fsid fsid;
u32 epoch, num_mon;
u16 version;
u32 len;
ceph_decode_32_safe(&p, end, len, bad);
ceph_decode_need(&p, end, len, bad);
dout("monmap_decode %p %p len %d\n", p, end, (int)(end-p));
ceph_decode_16_safe(&p, end, version, bad);
ceph_decode_need(&p, end, sizeof(fsid) + 2*sizeof(u32), bad);
ceph_decode_copy(&p, &fsid, sizeof(fsid));
epoch = ceph_decode_32(&p);
num_mon = ceph_decode_32(&p);
ceph_decode_need(&p, end, num_mon*sizeof(m->mon_inst[0]), bad);
if (num_mon >= CEPH_MAX_MON)
goto bad;
m = kmalloc(sizeof(*m) + sizeof(m->mon_inst[0])*num_mon, GFP_NOFS);
if (m == NULL)
return ERR_PTR(-ENOMEM);
m->fsid = fsid;
m->epoch = epoch;
m->num_mon = num_mon;
ceph_decode_copy(&p, m->mon_inst, num_mon*sizeof(m->mon_inst[0]));
for (i = 0; i < num_mon; i++)
ceph_decode_addr(&m->mon_inst[i].addr);
dout("monmap_decode epoch %d, num_mon %d\n", m->epoch,
m->num_mon);
for (i = 0; i < m->num_mon; i++)
dout("monmap_decode mon%d is %s\n", i,
ceph_pr_addr(&m->mon_inst[i].addr.in_addr));
return m;
bad:
dout("monmap_decode failed with %d\n", err);
kfree(m);
return ERR_PTR(err);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 358 | 99.72% | 4 | 80.00% |
Yehuda Sadeh Weinraub | 1 | 0.28% | 1 | 20.00% |
Total | 359 | 100.00% | 5 | 100.00% |
/*
* return true if *addr is included in the monmap.
*/
int ceph_monmap_contains(struct ceph_monmap *m, struct ceph_entity_addr *addr)
{
int i;
for (i = 0; i < m->num_mon; i++)
if (memcmp(addr, &m->mon_inst[i].addr, sizeof(*addr)) == 0)
return 1;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 64 | 100.00% | 2 | 100.00% |
Total | 64 | 100.00% | 2 | 100.00% |
/*
* Send an auth request.
*/
static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len)
{
monc->pending_auth = 1;
monc->m_auth->front.iov_len = len;
monc->m_auth->hdr.front_len = cpu_to_le32(len);
ceph_msg_revoke(monc->m_auth);
ceph_msg_get(monc->m_auth); /* keep our ref */
ceph_con_send(&monc->con, monc->m_auth);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 68 | 97.14% | 2 | 50.00% |
Alex Elder | 2 | 2.86% | 2 | 50.00% |
Total | 70 | 100.00% | 4 | 100.00% |
/*
* Close monitor session, if any.
*/
static void __close_session(struct ceph_mon_client *monc)
{
dout("__close_session closing mon%d\n", monc->cur_mon);
ceph_msg_revoke(monc->m_auth);
ceph_msg_revoke_incoming(monc->m_auth_reply);
ceph_msg_revoke(monc->m_subscribe);
ceph_msg_revoke_incoming(monc->m_subscribe_ack);
ceph_con_close(&monc->con);
monc->pending_auth = 0;
ceph_auth_reset(monc->auth);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 67 | 97.10% | 4 | 66.67% |
Alex Elder | 2 | 2.90% | 2 | 33.33% |
Total | 69 | 100.00% | 6 | 100.00% |
/*
* Pick a new monitor at random and set cur_mon. If we are repicking
* (i.e. cur_mon is already set), be sure to pick a different one.
*/
static void pick_new_mon(struct ceph_mon_client *monc)
{
int old_mon = monc->cur_mon;
BUG_ON(monc->monmap->num_mon < 1);
if (monc->monmap->num_mon == 1) {
monc->cur_mon = 0;
} else {
int max = monc->monmap->num_mon;
int o = -1;
int n;
if (monc->cur_mon >= 0) {
if (monc->cur_mon < monc->monmap->num_mon)
o = monc->cur_mon;
if (o >= 0)
max--;
}
n = prandom_u32() % max;
if (o >= 0 && n >= o)
n++;
monc->cur_mon = n;
}
dout("%s mon%d -> mon%d out of %d mons\n", __func__, old_mon,
monc->cur_mon, monc->monmap->num_mon);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 114 | 76.00% | 1 | 33.33% |
Sage Weil | 36 | 24.00% | 2 | 66.67% |
Total | 150 | 100.00% | 3 | 100.00% |
/*
* Open a session with a new monitor.
*/
static void __open_session(struct ceph_mon_client *monc)
{
int ret;
pick_new_mon(monc);
monc->hunting = true;
if (monc->had_a_connection) {
monc->hunt_mult *= CEPH_MONC_HUNT_BACKOFF;
if (monc->hunt_mult > CEPH_MONC_HUNT_MAX_MULT)
monc->hunt_mult = CEPH_MONC_HUNT_MAX_MULT;
}
monc->sub_renew_after = jiffies; /* i.e., expired */
monc->sub_renew_sent = 0;
dout("%s opening mon%d\n", __func__, monc->cur_mon);
ceph_con_open(&monc->con, CEPH_ENTITY_TYPE_MON, monc->cur_mon,
&monc->monmap->mon_inst[monc->cur_mon].addr);
/*
* send an initial keepalive to ensure our timestamp is valid
* by the time we are in an OPENED state
*/
ceph_con_keepalive(&monc->con);
/* initiate authentication handshake */
ret = ceph_auth_build_hello(monc->auth,
monc->m_auth->front.iov_base,
monc->m_auth->front_alloc_len);
BUG_ON(ret <= 0);
__send_prepared_auth_request(monc, ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 72 | 47.37% | 4 | 33.33% |
Ilya Dryomov | 63 | 41.45% | 5 | 41.67% |
Alex Elder | 9 | 5.92% | 2 | 16.67% |
Yan, Zheng | 8 | 5.26% | 1 | 8.33% |
Total | 152 | 100.00% | 12 | 100.00% |
static void reopen_session(struct ceph_mon_client *monc)
{
if (!monc->hunting)
pr_info("mon%d %s session lost, hunting for new mon\n",
monc->cur_mon, ceph_pr_addr(&monc->con.peer_addr.in_addr));
__close_session(monc);
__open_session(monc);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 49 | 100.00% | 1 | 100.00% |
Total | 49 | 100.00% | 1 | 100.00% |
/*
* Reschedule delayed work timer.
*/
static void __schedule_delayed(struct ceph_mon_client *monc)
{
unsigned long delay;
if (monc->hunting)
delay = CEPH_MONC_HUNT_INTERVAL * monc->hunt_mult;
else
delay = CEPH_MONC_PING_INTERVAL;
dout("__schedule_delayed after %lu\n", delay);
mod_delayed_work(system_wq, &monc->delayed_work,
round_jiffies_relative(delay));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 41 | 73.21% | 1 | 20.00% |
Ilya Dryomov | 9 | 16.07% | 3 | 60.00% |
Yan, Zheng | 6 | 10.71% | 1 | 20.00% |
Total | 56 | 100.00% | 5 | 100.00% |
const char *ceph_sub_str[] = {
[CEPH_SUB_MONMAP] = "monmap",
[CEPH_SUB_OSDMAP] = "osdmap",
[CEPH_SUB_FSMAP] = "fsmap.user",
[CEPH_SUB_MDSMAP] = "mdsmap",
};
/*
* Send subscribe request for one or more maps, according to
* monc->subs.
*/
static void __send_subscribe(struct ceph_mon_client *monc)
{
struct ceph_msg *msg = monc->m_subscribe;
void *p = msg->front.iov_base;
void *const end = p + msg->front_alloc_len;
int num = 0;
int i;
dout("%s sent %lu\n", __func__, monc->sub_renew_sent);
BUG_ON(monc->cur_mon < 0);
if (!monc->sub_renew_sent)
monc->sub_renew_sent = jiffies | 1; /* never 0 */
msg->hdr.version = cpu_to_le16(2);
for (i = 0; i < ARRAY_SIZE(monc->subs); i++) {
if (monc->subs[i].want)
num++;
}
BUG_ON(num < 1); /* monmap sub is always there */
ceph_encode_32(&p, num);
for (i = 0; i < ARRAY_SIZE(monc->subs); i++) {
char buf[32];
int len;
if (!monc->subs[i].want)
continue;
len = sprintf(buf, "%s", ceph_sub_str[i]);
if (i == CEPH_SUB_MDSMAP &&
monc->fs_cluster_id != CEPH_FS_CLUSTER_ID_NONE)
len += sprintf(buf + len, ".%d", monc->fs_cluster_id);
dout("%s %s start %llu flags 0x%x\n", __func__, buf,
le64_to_cpu(monc->subs[i].item.start),
monc->subs[i].item.flags);
ceph_encode_string(&p, end, buf, len);
memcpy(p, &monc->subs[i].item, sizeof(monc->subs[i].item));
p += sizeof(monc->subs[i].item);
}
BUG_ON(p > end);
msg->front.iov_len = p - msg->front.iov_base;
msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
ceph_msg_revoke(msg);
ceph_con_send(&monc->con, ceph_msg_get(msg));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 215 | 58.11% | 3 | 33.33% |
Sage Weil | 139 | 37.57% | 3 | 33.33% |
Yehuda Sadeh Weinraub | 14 | 3.78% | 1 | 11.11% |
Alex Elder | 2 | 0.54% | 2 | 22.22% |
Total | 370 | 100.00% | 9 | 100.00% |
static void handle_subscribe_ack(struct ceph_mon_client *monc,
struct ceph_msg *msg)
{
unsigned int seconds;
struct ceph_mon_subscribe_ack *h = msg->front.iov_base;
if (msg->front.iov_len < sizeof(*h))
goto bad;
seconds = le32_to_cpu(h->duration);
mutex_lock(&monc->mutex);
if (monc->sub_renew_sent) {
monc->sub_renew_after = monc->sub_renew_sent +
(seconds >> 1) * HZ - 1;
dout("%s sent %lu duration %d renew after %lu\n", __func__,
monc->sub_renew_sent, seconds, monc->sub_renew_after);
monc->sub_renew_sent = 0;
} else {
dout("%s sent %lu renew after %lu, ignoring\n", __func__,
monc->sub_renew_sent, monc->sub_renew_after);
}
mutex_unlock(&monc->mutex);
return;
bad:
pr_err("got corrupt subscribe-ack msg\n");
ceph_msg_dump(msg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 89 | 58.17% | 1 | 25.00% |
Sage Weil | 63 | 41.18% | 2 | 50.00% |
Eric Dumazet | 1 | 0.65% | 1 | 25.00% |
Total | 153 | 100.00% | 4 | 100.00% |
/*
* Register interest in a map
*
* @sub: one of CEPH_SUB_*
* @epoch: X for "every map since X", or 0 for "just the latest"
*/
static bool __ceph_monc_want_map(struct ceph_mon_client *monc, int sub,
u32 epoch, bool continuous)
{
__le64 start = cpu_to_le64(epoch);
u8 flags = !continuous ? CEPH_SUBSCRIBE_ONETIME : 0;
dout("%s %s epoch %u continuous %d\n", __func__, ceph_sub_str[sub],
epoch, continuous);
if (monc->subs[sub].want &&
monc->subs[sub].item.start == start &&
monc->subs[sub].item.flags == flags)
return false;
monc->subs[sub].item.start = start;
monc->subs[sub].item.flags = flags;
monc->subs[sub].want = true;
return true;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 134 | 100.00% | 1 | 100.00% |
Total | 134 | 100.00% | 1 | 100.00% |
bool ceph_monc_want_map(struct ceph_mon_client *monc, int sub, u32 epoch,
bool continuous)
{
bool need_request;
mutex_lock(&monc->mutex);
need_request = __ceph_monc_want_map(monc, sub, epoch, continuous);
mutex_unlock(&monc->mutex);
return need_request;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 42 | 77.78% | 1 | 50.00% |
Sage Weil | 12 | 22.22% | 1 | 50.00% |
Total | 54 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(ceph_monc_want_map);
/*
* Keep track of which maps we have
*
* @sub: one of CEPH_SUB_*
*/
static void __ceph_monc_got_map(struct ceph_mon_client *monc, int sub,
u32 epoch)
{
dout("%s %s epoch %u\n", __func__, ceph_sub_str[sub], epoch);
if (monc->subs[sub].want) {
if (monc->subs[sub].item.flags & CEPH_SUBSCRIBE_ONETIME)
monc->subs[sub].want = false;
else
monc->subs[sub].item.start = cpu_to_le64(epoch + 1);
}
monc->subs[sub].have = epoch;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 78 | 78.00% | 1 | 50.00% |
Sage Weil | 22 | 22.00% | 1 | 50.00% |
Total | 100 | 100.00% | 2 | 100.00% |
void ceph_monc_got_map(struct ceph_mon_client *monc, int sub, u32 epoch)
{
mutex_lock(&monc->mutex);
__ceph_monc_got_map(monc, sub, epoch);
mutex_unlock(&monc->mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 28 | 68.29% | 1 | 50.00% |
Ilya Dryomov | 13 | 31.71% | 1 | 50.00% |
Total | 41 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(ceph_monc_got_map);
void ceph_monc_renew_subs(struct ceph_mon_client *monc)
{
mutex_lock(&monc->mutex);
__send_subscribe(monc);
mutex_unlock(&monc->mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 31 | 100.00% | 1 | 100.00% |
Total | 31 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(ceph_monc_renew_subs);
/*
* Wait for an osdmap with a given epoch.
*
* @epoch: epoch to wait for
* @timeout: in jiffies, 0 means "wait forever"
*/
int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
unsigned long timeout)
{
unsigned long started = jiffies;
long ret;
mutex_lock(&monc->mutex);
while (monc->subs[CEPH_SUB_OSDMAP].have < epoch) {
mutex_unlock(&monc->mutex);
if (timeout && time_after_eq(jiffies, started + timeout))
return -ETIMEDOUT;
ret = wait_event_interruptible_timeout(monc->client->auth_wq,
monc->subs[CEPH_SUB_OSDMAP].have >= epoch,
ceph_timeout_jiffies(timeout));
if (ret < 0)
return ret;
mutex_lock(&monc->mutex);
}
mutex_unlock(&monc->mutex);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 129 | 100.00% | 4 | 100.00% |
Total | 129 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(ceph_monc_wait_osdmap);
/*
* Open a session with a random monitor. Request monmap and osdmap,
* which are waited upon in __ceph_open_session().
*/
int ceph_monc_open_session(struct ceph_mon_client *monc)
{
mutex_lock(&monc->mutex);
__ceph_monc_want_map(monc, CEPH_SUB_MONMAP, 0, true);
__ceph_monc_want_map(monc, CEPH_SUB_OSDMAP, 0, false);
__open_session(monc);
__schedule_delayed(monc);
mutex_unlock(&monc->mutex);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 39 | 63.93% | 2 | 66.67% |
Ilya Dryomov | 22 | 36.07% | 1 | 33.33% |
Total | 61 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(ceph_monc_open_session);
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);
__ceph_monc_got_map(monc, CEPH_SUB_MONMAP, monc->monmap->epoch);
client->have_fsid = true;
out:
mutex_unlock(&monc->mutex);
wake_up_all(&client->auth_wq);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 173 | 92.51% | 6 | 75.00% |
Ilya Dryomov | 13 | 6.95% | 1 | 12.50% |
Yehuda Sadeh Weinraub | 1 | 0.53% | 1 | 12.50% |
Total | 187 | 100.00% | 8 | 100.00% |
/*
* generic requests (currently statfs, mon_get_version)
*/
DEFINE_RB_FUNCS(generic_request, struct ceph_mon_generic_request, tid, node)
static void release_generic_request(struct kref *kref)
{
struct ceph_mon_generic_request *req =
container_of(kref, struct ceph_mon_generic_request, kref);
dout("%s greq %p request %p reply %p\n", __func__, req, req->request,
req->reply);
WARN_ON(!RB_EMPTY_NODE(&req->node));
if (req->reply)
ceph_msg_put(req->reply);
if (req->request)
ceph_msg_put(req->request);
kfree(req);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 49 | 56.98% | 1 | 25.00% |
Ilya Dryomov | 29 | 33.72% | 1 | 25.00% |
Yehuda Sadeh Weinraub | 8 | 9.30% | 2 | 50.00% |
Total | 86 | 100.00% | 4 | 100.00% |
static void put_generic_request(struct ceph_mon_generic_request *req)
{
if (req)
kref_put(&req->kref, release_generic_request);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
static void get_generic_request(struct ceph_mon_generic_request *req)
{
kref_get(&req->kref);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 19 | 100.00% | 1 | 100.00% |
Total | 19 | 100.00% | 1 | 100.00% |
static struct ceph_mon_generic_request *
alloc_generic_request(struct ceph_mon_client *monc, gfp_t gfp)
{
struct ceph_mon_generic_request *req;
req = kzalloc(sizeof(*req), gfp);
if (!req)
return NULL;
req->monc = monc;
kref_init(&req->kref);
RB_CLEAR_NODE(&req->node);
init_completion(&req->completion);
dout("%s greq %p\n", __func__, req);
return req;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 84 | 100.00% | 1 | 100.00% |
Total | 84 | 100.00% | 1 | 100.00% |
static void register_generic_request(struct ceph_mon_generic_request *req)
{
struct ceph_mon_client *monc = req->monc;
WARN_ON(req->tid);
get_generic_request(req);
req->tid = ++monc->last_tid;
insert_generic_request(&monc->generic_request_tree, req);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 51 | 100.00% | 1 | 100.00% |
Total | 51 | 100.00% | 1 | 100.00% |
static void send_generic_request(struct ceph_mon_client *monc,
struct ceph_mon_generic_request *req)
{
WARN_ON(!req->tid);
dout("%s greq %p tid %llu\n", __func__, req, req->tid);
req->request->hdr.tid = cpu_to_le64(req->tid);
ceph_con_send(&monc->con, ceph_msg_get(req->request));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 67 | 100.00% | 1 | 100.00% |
Total | 67 | 100.00% | 1 | 100.00% |
static void __finish_generic_request(struct ceph_mon_generic_request *req)
{
struct ceph_mon_client *monc = req->monc;
dout("%s greq %p tid %llu\n", __func__, req, req->tid);
erase_generic_request(&monc->generic_request_tree, req);
ceph_msg_revoke(req->request);
ceph_msg_revoke_incoming(req->reply);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 57 | 100.00% | 1 | 100.00% |
Total | 57 | 100.00% | 1 | 100.00% |
static void finish_generic_request(struct ceph_mon_generic_request *req)
{
__finish_generic_request(req);
put_generic_request(req);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 21 | 100.00% | 1 | 100.00% |
Total | 21 | 100.00% | 1 | 100.00% |
static void complete_generic_request(struct ceph_mon_generic_request *req)
{
if (req->complete_cb)
req->complete_cb(req);
else
complete_all(&req->completion);
put_generic_request(req);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 38 | 100.00% | 1 | 100.00% |
Total | 38 | 100.00% | 1 | 100.00% |
static void cancel_generic_request(struct ceph_mon_generic_request *req)
{
struct ceph_mon_client *monc = req->monc;
struct ceph_mon_generic_request *lookup_req;
dout("%s greq %p tid %llu\n", __func__, req, req->tid);
mutex_lock(&monc->mutex);
lookup_req = lookup_generic_request(&monc->generic_request_tree,
req->tid);
if (lookup_req) {
WARN_ON(lookup_req != req);
finish_generic_request(req);
}
mutex_unlock(&monc->mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 85 | 98.84% | 1 | 50.00% |
Wei Yongjun | 1 | 1.16% | 1 | 50.00% |
Total | 86 | 100.00% | 2 | 100.00% |
static int wait_generic_request(struct ceph_mon_generic_request *req)
{
int ret;
dout("%s greq %p tid %llu\n", __func__, req, req->tid);
ret = wait_for_completion_interruptible(&req->completion);
if (ret)
cancel_generic_request(req);
else
ret = req->result; /* completed */
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ilya Dryomov | 37 | 64.91% | 1 | 33.33% |
Sage Weil | 19 | 33.33% | 1 | 33.33% |
Yehuda Sadeh Weinraub | 1 | 1.75% | 1 | 33.33% |
Total | 57 | 100.00% | 3 | 100.00% |
static struct ceph_msg *get_generic_reply(struct ceph_connection *con,
struct ceph_msg_header *hdr,
int *skip)
{
struct ceph_mon_client *monc = con->private;
struct ceph_mon_generic_request *req;
u64 tid = le64_to_cpu(hdr->tid);
struct ceph_msg *m;
mutex_lock(&monc->mutex);
req = lookup_generic_request(&monc->generic_request_tree, tid);
if (!req) {
dout("get_generic_reply %lld dne\n", tid);
*skip = 1;
m = NULL;
} else {
dout("get_generic_reply %lld got %p\n", tid, req->reply);
*skip = 0;
m = ceph_msg_get(req->reply);
/*
* we don't need to track the connection reading into
* this reply because we only have one open connection
* at a time, ever.
*/
}
mutex_unlock(&monc->mutex);
return m;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sage Weil | 121 | 90.30% | 1 | 25.00% |
Alex Elder | 5 | 3.73% | 1 | 25.00% |
Ilya Dryomov | 4 | 2.99% | 1 | 25.00% |
Yehuda Sadeh Weinraub | 4 | 2.99% | 1 | 25.00% |
Total | 134 | 100.00% | 4 | 100.00% |
/*
* statfs
*/