aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-08-02 18:09:39 -0400
committerSage Weil <sage@newdream.net>2010-08-02 18:48:49 -0400
commitce1fbc8dd657a4bbcf26c683c9d07c88db83fd86 (patch)
tree5ff998e85e35f6938cd316c2f9147c87a6a5faab /fs/ceph
parentcbbfe499055f49c09210e04d9f88c2f483052384 (diff)
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>
Diffstat (limited to 'fs/ceph')
-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 30acc7b046ee..51546d54b841 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2698,6 +2698,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2698 u64 size, max_size; 2698 u64 size, max_size;
2699 u64 tid; 2699 u64 tid;
2700 void *snaptrace; 2700 void *snaptrace;
2701 size_t snaptrace_len;
2702 void *flock;
2703 u32 flock_len;
2701 int open_target_sessions = 0; 2704 int open_target_sessions = 0;
2702 2705
2703 dout("handle_caps from mds%d\n", mds); 2706 dout("handle_caps from mds%d\n", mds);
@@ -2707,7 +2710,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2707 if (msg->front.iov_len < sizeof(*h)) 2710 if (msg->front.iov_len < sizeof(*h))
2708 goto bad; 2711 goto bad;
2709 h = msg->front.iov_base; 2712 h = msg->front.iov_base;
2710 snaptrace = h + 1;
2711 op = le32_to_cpu(h->op); 2713 op = le32_to_cpu(h->op);
2712 vino.ino = le64_to_cpu(h->ino); 2714 vino.ino = le64_to_cpu(h->ino);
2713 vino.snap = CEPH_NOSNAP; 2715 vino.snap = CEPH_NOSNAP;
@@ -2717,6 +2719,21 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2717 size = le64_to_cpu(h->size); 2719 size = le64_to_cpu(h->size);
2718 max_size = le64_to_cpu(h->max_size); 2720 max_size = le64_to_cpu(h->max_size);
2719 2721
2722 snaptrace = h + 1;
2723 snaptrace_len = le32_to_cpu(h->snap_trace_len);
2724
2725 if (le16_to_cpu(msg->hdr.version) >= 2) {
2726 void *p, *end;
2727
2728 p = snaptrace + snaptrace_len;
2729 end = msg->front.iov_base + msg->front.iov_len;
2730 ceph_decode_32_safe(&p, end, flock_len, bad);
2731 flock = p;
2732 } else {
2733 flock = NULL;
2734 flock_len = 0;
2735 }
2736
2720 mutex_lock(&session->s_mutex); 2737 mutex_lock(&session->s_mutex);
2721 session->s_seq++; 2738 session->s_seq++;
2722 dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, 2739 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 2772
2756 case CEPH_CAP_OP_IMPORT: 2773 case CEPH_CAP_OP_IMPORT:
2757 handle_cap_import(mdsc, inode, h, session, 2774 handle_cap_import(mdsc, inode, h, session,
2758 snaptrace, le32_to_cpu(h->snap_trace_len)); 2775 snaptrace, snaptrace_len);
2759 ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY, 2776 ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY,
2760 session); 2777 session);
2761 goto done_unlocked; 2778 goto done_unlocked;