summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2016-11-10 07:42:05 -0500
committerIlya Dryomov <idryomov@gmail.com>2016-12-12 17:54:28 -0500
commit43b29673307387f7b939fceeedefd08ece13c41d (patch)
tree556beac7cd5614d3a0114f99923a138be3c8ef4b /fs/ceph/caps.c
parent0ff8bfb394124a7ff4f5a4cd3dc9e8dc52dbe5c9 (diff)
ceph: update cap message struct version to 10
The userland ceph has MClientCaps at struct version 10. This brings the kernel up the same version. For now, all of the the new stuff is set to default values including the flags field, which will be conditionally set in a later patch. Note that we don't need to set the change_attr and btime to anything since we aren't currently setting the feature flag. The MDS should ignore those values. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 2bb183d764ae..508663ed413c 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1013,6 +1013,7 @@ static int send_cap_msg(struct cap_msg_args *arg)
1013 struct ceph_msg *msg; 1013 struct ceph_msg *msg;
1014 void *p; 1014 void *p;
1015 size_t extra_len; 1015 size_t extra_len;
1016 struct timespec zerotime = {0};
1016 1017
1017 dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s" 1018 dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s"
1018 " seq %u/%u tid %llu/%llu mseq %u follows %lld size %llu/%llu" 1019 " seq %u/%u tid %llu/%llu mseq %u follows %lld size %llu/%llu"
@@ -1026,13 +1027,13 @@ static int send_cap_msg(struct cap_msg_args *arg)
1026 1027
1027 /* flock buffer size + inline version + inline data size + 1028 /* flock buffer size + inline version + inline data size +
1028 * osd_epoch_barrier + oldest_flush_tid */ 1029 * osd_epoch_barrier + oldest_flush_tid */
1029 extra_len = 4 + 8 + 4 + 4 + 8; 1030 extra_len = 4 + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 8 + 8 + 4;
1030 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc) + extra_len, 1031 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc) + extra_len,
1031 GFP_NOFS, false); 1032 GFP_NOFS, false);
1032 if (!msg) 1033 if (!msg)
1033 return -ENOMEM; 1034 return -ENOMEM;
1034 1035
1035 msg->hdr.version = cpu_to_le16(6); 1036 msg->hdr.version = cpu_to_le16(10);
1036 msg->hdr.tid = cpu_to_le64(arg->flush_tid); 1037 msg->hdr.tid = cpu_to_le64(arg->flush_tid);
1037 1038
1038 fc = msg->front.iov_base; 1039 fc = msg->front.iov_base;
@@ -1068,17 +1069,43 @@ static int send_cap_msg(struct cap_msg_args *arg)
1068 } 1069 }
1069 1070
1070 p = fc + 1; 1071 p = fc + 1;
1071 /* flock buffer size */ 1072 /* flock buffer size (version 2) */
1072 ceph_encode_32(&p, 0); 1073 ceph_encode_32(&p, 0);
1073 /* inline version */ 1074 /* inline version (version 4) */
1074 ceph_encode_64(&p, arg->inline_data ? 0 : CEPH_INLINE_NONE); 1075 ceph_encode_64(&p, arg->inline_data ? 0 : CEPH_INLINE_NONE);
1075 /* inline data size */ 1076 /* inline data size */
1076 ceph_encode_32(&p, 0); 1077 ceph_encode_32(&p, 0);
1077 /* osd_epoch_barrier */ 1078 /* osd_epoch_barrier (version 5) */
1078 ceph_encode_32(&p, 0); 1079 ceph_encode_32(&p, 0);
1079 /* oldest_flush_tid */ 1080 /* oldest_flush_tid (version 6) */
1080 ceph_encode_64(&p, arg->oldest_flush_tid); 1081 ceph_encode_64(&p, arg->oldest_flush_tid);
1081 1082
1083 /*
1084 * caller_uid/caller_gid (version 7)
1085 *
1086 * Currently, we don't properly track which caller dirtied the caps
1087 * last, and force a flush of them when there is a conflict. For now,
1088 * just set this to 0:0, to emulate how the MDS has worked up to now.
1089 */
1090 ceph_encode_32(&p, 0);
1091 ceph_encode_32(&p, 0);
1092
1093 /* pool namespace (version 8) (mds always ignores this) */
1094 ceph_encode_32(&p, 0);
1095
1096 /*
1097 * btime and change_attr (version 9)
1098 *
1099 * We just zero these out for now, as the MDS ignores them unless
1100 * the requisite feature flags are set (which we don't do yet).
1101 */
1102 ceph_encode_timespec(p, &zerotime);
1103 p += sizeof(struct ceph_timespec);
1104 ceph_encode_64(&p, 0);
1105
1106 /* Advisory flags (version 10) */
1107 ceph_encode_32(&p, 0);
1108
1082 ceph_con_send(&arg->session->s_con, msg); 1109 ceph_con_send(&arg->session->s_con, msg);
1083 return 0; 1110 return 0;
1084} 1111}