summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-04-13 11:07:04 -0400
committerIlya Dryomov <idryomov@gmail.com>2017-05-04 03:19:21 -0400
commit92475f05bdb6daefce3f55f46551153e7ed05f45 (patch)
treedee77a889f3dee44d2441bb50430f24c98a6d8ea /fs/ceph/caps.c
parent58eb7932ae4d671d2a2377a1779eda96a2789b11 (diff)
ceph: handle epoch barriers in cap messages
Have the client store and update the osdc epoch_barrier when a cap message comes in with one. When sending cap messages, send the epoch barrier as well. This allows clients to inform servers that their released caps may not be used until a particular OSD map epoch. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: "Yan, Zheng” <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 60185434162a..a3ebb632294e 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1015,6 +1015,7 @@ static int send_cap_msg(struct cap_msg_args *arg)
1015 void *p; 1015 void *p;
1016 size_t extra_len; 1016 size_t extra_len;
1017 struct timespec zerotime = {0}; 1017 struct timespec zerotime = {0};
1018 struct ceph_osd_client *osdc = &arg->session->s_mdsc->fsc->client->osdc;
1018 1019
1019 dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s" 1020 dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s"
1020 " seq %u/%u tid %llu/%llu mseq %u follows %lld size %llu/%llu" 1021 " seq %u/%u tid %llu/%llu mseq %u follows %lld size %llu/%llu"
@@ -1076,8 +1077,12 @@ static int send_cap_msg(struct cap_msg_args *arg)
1076 ceph_encode_64(&p, arg->inline_data ? 0 : CEPH_INLINE_NONE); 1077 ceph_encode_64(&p, arg->inline_data ? 0 : CEPH_INLINE_NONE);
1077 /* inline data size */ 1078 /* inline data size */
1078 ceph_encode_32(&p, 0); 1079 ceph_encode_32(&p, 0);
1079 /* osd_epoch_barrier (version 5) */ 1080 /*
1080 ceph_encode_32(&p, 0); 1081 * osd_epoch_barrier (version 5)
1082 * The epoch_barrier is protected osdc->lock, so READ_ONCE here in
1083 * case it was recently changed
1084 */
1085 ceph_encode_32(&p, READ_ONCE(osdc->epoch_barrier));
1081 /* oldest_flush_tid (version 6) */ 1086 /* oldest_flush_tid (version 6) */
1082 ceph_encode_64(&p, arg->oldest_flush_tid); 1087 ceph_encode_64(&p, arg->oldest_flush_tid);
1083 1088
@@ -3633,13 +3638,19 @@ void ceph_handle_caps(struct ceph_mds_session *session,
3633 p += inline_len; 3638 p += inline_len;
3634 } 3639 }
3635 3640
3641 if (le16_to_cpu(msg->hdr.version) >= 5) {
3642 struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc;
3643 u32 epoch_barrier;
3644
3645 ceph_decode_32_safe(&p, end, epoch_barrier, bad);
3646 ceph_osdc_update_epoch_barrier(osdc, epoch_barrier);
3647 }
3648
3636 if (le16_to_cpu(msg->hdr.version) >= 8) { 3649 if (le16_to_cpu(msg->hdr.version) >= 8) {
3637 u64 flush_tid; 3650 u64 flush_tid;
3638 u32 caller_uid, caller_gid; 3651 u32 caller_uid, caller_gid;
3639 u32 osd_epoch_barrier;
3640 u32 pool_ns_len; 3652 u32 pool_ns_len;
3641 /* version >= 5 */ 3653
3642 ceph_decode_32_safe(&p, end, osd_epoch_barrier, bad);
3643 /* version >= 6 */ 3654 /* version >= 6 */
3644 ceph_decode_64_safe(&p, end, flush_tid, bad); 3655 ceph_decode_64_safe(&p, end, flush_tid, bad);
3645 /* version >= 7 */ 3656 /* version >= 7 */