diff options
author | Sage Weil <sage@newdream.net> | 2010-05-10 18:36:44 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:33 -0400 |
commit | e01a594646ebbf964b6058e3bf28125379063439 (patch) | |
tree | 046b2acf54f803b60e873f419014472128103d53 /fs/ceph/mds_client.c | |
parent | f8c76f6f250edbdc9d2011b0e05d196a3d8ae895 (diff) |
ceph: dicard cap releases on mds restart
If the MDS restarts, the expire caps state is no longer shared, and can be
thrown out. Caps state will be rebuilt on the MDS during the reconnect
process that follows. Zero out any release messages and adjust the
release counter accordingly.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-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) |