提交 ce1fbc8d 编写于 作者: S Sage Weil

ceph: support v2 client_caps encoding

Add support for v2 encoding of MClientCaps, which includes a flock blob.
Signed-off-by: NSage Weil <sage@newdream.net>
上级 cbbfe499
...@@ -2698,6 +2698,9 @@ void ceph_handle_caps(struct ceph_mds_session *session, ...@@ -2698,6 +2698,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
u64 size, max_size; u64 size, max_size;
u64 tid; u64 tid;
void *snaptrace; void *snaptrace;
size_t snaptrace_len;
void *flock;
u32 flock_len;
int open_target_sessions = 0; int open_target_sessions = 0;
dout("handle_caps from mds%d\n", mds); dout("handle_caps from mds%d\n", mds);
...@@ -2707,7 +2710,6 @@ void ceph_handle_caps(struct ceph_mds_session *session, ...@@ -2707,7 +2710,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
if (msg->front.iov_len < sizeof(*h)) if (msg->front.iov_len < sizeof(*h))
goto bad; goto bad;
h = msg->front.iov_base; h = msg->front.iov_base;
snaptrace = h + 1;
op = le32_to_cpu(h->op); op = le32_to_cpu(h->op);
vino.ino = le64_to_cpu(h->ino); vino.ino = le64_to_cpu(h->ino);
vino.snap = CEPH_NOSNAP; vino.snap = CEPH_NOSNAP;
...@@ -2717,6 +2719,21 @@ void ceph_handle_caps(struct ceph_mds_session *session, ...@@ -2717,6 +2719,21 @@ void ceph_handle_caps(struct ceph_mds_session *session,
size = le64_to_cpu(h->size); size = le64_to_cpu(h->size);
max_size = le64_to_cpu(h->max_size); max_size = le64_to_cpu(h->max_size);
snaptrace = h + 1;
snaptrace_len = le32_to_cpu(h->snap_trace_len);
if (le16_to_cpu(msg->hdr.version) >= 2) {
void *p, *end;
p = snaptrace + snaptrace_len;
end = msg->front.iov_base + msg->front.iov_len;
ceph_decode_32_safe(&p, end, flock_len, bad);
flock = p;
} else {
flock = NULL;
flock_len = 0;
}
mutex_lock(&session->s_mutex); mutex_lock(&session->s_mutex);
session->s_seq++; session->s_seq++;
dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq,
...@@ -2755,7 +2772,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, ...@@ -2755,7 +2772,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
case CEPH_CAP_OP_IMPORT: case CEPH_CAP_OP_IMPORT:
handle_cap_import(mdsc, inode, h, session, handle_cap_import(mdsc, inode, h, session,
snaptrace, le32_to_cpu(h->snap_trace_len)); snaptrace, snaptrace_len);
ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY, ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY,
session); session);
goto done_unlocked; goto done_unlocked;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册