diff options
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/mds_client.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 824a9b2cde71..a4d9e5b0fd3d 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1157,6 +1157,44 @@ static void send_cap_releases(struct ceph_mds_client *mdsc, | |||
1157 | spin_unlock(&session->s_cap_lock); | 1157 | spin_unlock(&session->s_cap_lock); |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | static void discard_cap_releases(struct ceph_mds_client *mdsc, | ||
1161 | struct ceph_mds_session *session) | ||
1162 | { | ||
1163 | struct ceph_msg *msg; | ||
1164 | struct ceph_mds_cap_release *head; | ||
1165 | unsigned num; | ||
1166 | |||
1167 | dout("discard_cap_releases mds%d\n", session->s_mds); | ||
1168 | spin_lock(&session->s_cap_lock); | ||
1169 | |||
1170 | /* zero out the in-progress message */ | ||
1171 | msg = list_first_entry(&session->s_cap_releases, | ||
1172 | struct ceph_msg, list_head); | ||
1173 | head = msg->front.iov_base; | ||
1174 | num = le32_to_cpu(head->num); | ||
1175 | dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg, num); | ||
1176 | head->num = cpu_to_le32(0); | ||
1177 | session->s_num_cap_releases += num; | ||
1178 | |||
1179 | /* requeue completed messages */ | ||
1180 | while (!list_empty(&session->s_cap_releases_done)) { | ||
1181 | msg = list_first_entry(&session->s_cap_releases_done, | ||
1182 | struct ceph_msg, list_head); | ||
1183 | list_del_init(&msg->list_head); | ||
1184 | |||
1185 | head = msg->front.iov_base; | ||
1186 | num = le32_to_cpu(head->num); | ||
1187 | dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg, | ||
1188 | num); | ||
1189 | session->s_num_cap_releases += num; | ||
1190 | head->num = cpu_to_le32(0); | ||
1191 | msg->front.iov_len = sizeof(*head); | ||
1192 | list_add(&msg->list_head, &session->s_cap_releases); | ||
1193 | } | ||
1194 | |||
1195 | spin_unlock(&session->s_cap_lock); | ||
1196 | } | ||
1197 | |||
1160 | /* | 1198 | /* |
1161 | * requests | 1199 | * requests |
1162 | */ | 1200 | */ |
@@ -2183,6 +2221,9 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) | |||
2183 | dout("session %p state %s\n", session, | 2221 | dout("session %p state %s\n", session, |
2184 | session_state_name(session->s_state)); | 2222 | session_state_name(session->s_state)); |
2185 | 2223 | ||
2224 | /* drop old cap expires; we're about to reestablish that state */ | ||
2225 | discard_cap_releases(mdsc, session); | ||
2226 | |||
2186 | /* traverse this session's caps */ | 2227 | /* traverse this session's caps */ |
2187 | err = ceph_pagelist_encode_32(pagelist, session->s_nr_caps); | 2228 | err = ceph_pagelist_encode_32(pagelist, session->s_nr_caps); |
2188 | if (err) | 2229 | if (err) |