aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-09 15:05:48 -0500
committerSage Weil <sage@newdream.net>2009-11-09 15:06:07 -0500
commit685f9a5d14194fc35db73e5e7370740ccc14b64a (patch)
tree4c34ac2348149d91ad5e08cd105207810f0afdc9 /fs/ceph/mds_client.c
parentfb690390e305ea51e1883b105c7d3c52d7100ba5 (diff)
ceph: do not confuse stale and dead (unreconnected) caps
We were using the cap_gen to track both stale caps (caps that timed out due to temporarily losing touch with the mds) and dead caps that did not reconnect after an MDS failure. Introduce a recon_gen counter to track reconnections to restarted MDSs and kill dead caps based on that instead. Rename gen to cap_gen while we're at it to make it more clear which is which. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 210cb6623ea2..828417ae16f9 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -329,6 +329,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
329 ceph_con_open(&s->s_con, ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); 329 ceph_con_open(&s->s_con, ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
330 330
331 spin_lock_init(&s->s_cap_lock); 331 spin_lock_init(&s->s_cap_lock);
332 s->s_recon_gen = 0;
332 s->s_cap_gen = 0; 333 s->s_cap_gen = 0;
333 s->s_cap_ttl = 0; 334 s->s_cap_ttl = 0;
334 s->s_renew_requested = 0; 335 s->s_renew_requested = 0;
@@ -738,10 +739,11 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
738 struct ceph_mds_session *session = arg; 739 struct ceph_mds_session *session = arg;
739 740
740 spin_lock(&inode->i_lock); 741 spin_lock(&inode->i_lock);
741 if (cap->gen != session->s_cap_gen) { 742 if (cap->recon_gen != session->s_recon_gen) {
742 pr_err("failed reconnect %p %llx.%llx cap %p " 743 pr_err("failed reconnect %p %llx.%llx cap %p "
743 "(gen %d < session %d)\n", inode, ceph_vinop(inode), 744 "(recon_gen %d < session %d)\n", inode,
744 cap, cap->gen, session->s_cap_gen); 745 ceph_vinop(inode), cap,
746 cap->recon_gen, session->s_recon_gen);
745 __ceph_remove_cap(cap, NULL); 747 __ceph_remove_cap(cap, NULL);
746 } 748 }
747 wake_up(&ceph_inode(inode)->i_cap_wq); 749 wake_up(&ceph_inode(inode)->i_cap_wq);
@@ -2050,6 +2052,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
2050 2052
2051 session->s_state = CEPH_MDS_SESSION_RECONNECTING; 2053 session->s_state = CEPH_MDS_SESSION_RECONNECTING;
2052 session->s_seq = 0; 2054 session->s_seq = 0;
2055 session->s_recon_gen++;
2053 2056
2054 ceph_con_open(&session->s_con, 2057 ceph_con_open(&session->s_con,
2055 ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); 2058 ceph_mdsmap_get_addr(mdsc->mdsmap, mds));