summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-08-02 15:09:39 -0700
committerSage Weil <sage@newdream.net>2010-08-02 15:48:49 -0700
commitce1fbc8dd657a4bbcf26c683c9d07c88db83fd86 (patch)
tree5ff998e85e35f6938cd316c2f9147c87a6a5faab
parentcbbfe499055f49c09210e04d9f88c2f483052384 (diff)
downloadlinux-3.10-ce1fbc8dd657a4bbcf26c683c9d07c88db83fd86.tar.gz
linux-3.10-ce1fbc8dd657a4bbcf26c683c9d07c88db83fd86.tar.bz2
linux-3.10-ce1fbc8dd657a4bbcf26c683c9d07c88db83fd86.zip
ceph: support v2 client_caps encoding
Add support for v2 encoding of MClientCaps, which includes a flock blob. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/caps.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 30acc7b046e..51546d54b84 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2698,6 +2698,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
u64 size, max_size;
u64 tid;
void *snaptrace;
+ size_t snaptrace_len;
+ void *flock;
+ u32 flock_len;
int open_target_sessions = 0;
dout("handle_caps from mds%d\n", mds);
@@ -2707,7 +2710,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
if (msg->front.iov_len < sizeof(*h))
goto bad;
h = msg->front.iov_base;
- snaptrace = h + 1;
op = le32_to_cpu(h->op);
vino.ino = le64_to_cpu(h->ino);
vino.snap = CEPH_NOSNAP;
@@ -2717,6 +2719,21 @@ void ceph_handle_caps(struct ceph_mds_session *session,
size = le64_to_cpu(h->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);
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,
case CEPH_CAP_OP_IMPORT:
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,
session);
goto done_unlocked;