Commit cdac8303 authored by Sage Weil's avatar Sage Weil

ceph: remove recon_gen logic

We don't get an explicit affirmative confirmation that our caps reconnect,
nor do we necessarily want to pay that cost.  So, take all this code out
for now.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent eed0ef2c
...@@ -610,7 +610,6 @@ int ceph_add_cap(struct inode *inode, ...@@ -610,7 +610,6 @@ int ceph_add_cap(struct inode *inode,
cap->issue_seq = seq; cap->issue_seq = seq;
cap->mseq = mseq; cap->mseq = mseq;
cap->cap_gen = session->s_cap_gen; cap->cap_gen = session->s_cap_gen;
cap->recon_gen = session->s_recon_gen;
if (fmode >= 0) if (fmode >= 0)
__ceph_get_fmode(ci, fmode); __ceph_get_fmode(ci, fmode);
...@@ -627,21 +626,13 @@ int ceph_add_cap(struct inode *inode, ...@@ -627,21 +626,13 @@ int ceph_add_cap(struct inode *inode,
static int __cap_is_valid(struct ceph_cap *cap) static int __cap_is_valid(struct ceph_cap *cap)
{ {
unsigned long ttl; unsigned long ttl;
u32 gen, recon_gen; u32 gen;
spin_lock(&cap->session->s_cap_lock); spin_lock(&cap->session->s_cap_lock);
gen = cap->session->s_cap_gen; gen = cap->session->s_cap_gen;
recon_gen = cap->session->s_recon_gen;
ttl = cap->session->s_cap_ttl; ttl = cap->session->s_cap_ttl;
spin_unlock(&cap->session->s_cap_lock); spin_unlock(&cap->session->s_cap_lock);
if (cap->recon_gen != recon_gen) {
dout("__cap_is_valid %p cap %p issued %s "
"but DEAD (recon_gen %u vs %u)\n", &cap->ci->vfs_inode,
cap, ceph_cap_string(cap->issued), cap->recon_gen,
recon_gen);
return 0;
}
if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) { if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) {
dout("__cap_is_valid %p cap %p issued %s " dout("__cap_is_valid %p cap %p issued %s "
"but STALE (gen %u vs %u)\n", &cap->ci->vfs_inode, "but STALE (gen %u vs %u)\n", &cap->ci->vfs_inode,
...@@ -2213,7 +2204,6 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, ...@@ -2213,7 +2204,6 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
issued |= implemented | __ceph_caps_dirty(ci); issued |= implemented | __ceph_caps_dirty(ci);
cap->cap_gen = session->s_cap_gen; cap->cap_gen = session->s_cap_gen;
cap->recon_gen = session->s_recon_gen;
__check_cap_issue(ci, cap, newcaps); __check_cap_issue(ci, cap, newcaps);
......
...@@ -329,7 +329,6 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, ...@@ -329,7 +329,6 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
ceph_con_open(&s->s_con, ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); ceph_con_open(&s->s_con, ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
spin_lock_init(&s->s_cap_lock); spin_lock_init(&s->s_cap_lock);
s->s_recon_gen = 0;
s->s_cap_gen = 0; s->s_cap_gen = 0;
s->s_cap_ttl = 0; s->s_cap_ttl = 0;
s->s_renew_requested = 0; s->s_renew_requested = 0;
...@@ -736,25 +735,14 @@ static void remove_session_caps(struct ceph_mds_session *session) ...@@ -736,25 +735,14 @@ static void remove_session_caps(struct ceph_mds_session *session)
static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap, static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
void *arg) void *arg)
{ {
struct ceph_mds_session *session = arg;
spin_lock(&inode->i_lock);
if (cap->recon_gen != session->s_recon_gen) {
pr_err("failed reconnect %p %llx.%llx cap %p "
"(recon_gen %d < session %d)\n", inode,
ceph_vinop(inode), cap,
cap->recon_gen, session->s_recon_gen);
__ceph_remove_cap(cap, NULL);
}
wake_up(&ceph_inode(inode)->i_cap_wq); wake_up(&ceph_inode(inode)->i_cap_wq);
spin_unlock(&inode->i_lock);
return 0; return 0;
} }
static void wake_up_session_caps(struct ceph_mds_session *session) static void wake_up_session_caps(struct ceph_mds_session *session)
{ {
dout("wake_up_session_caps %p mds%d\n", session, session->s_mds); dout("wake_up_session_caps %p mds%d\n", session, session->s_mds);
iterate_session_caps(session, wake_up_session_cb, session); iterate_session_caps(session, wake_up_session_cb, NULL);
} }
/* /*
...@@ -2052,7 +2040,6 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) ...@@ -2052,7 +2040,6 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
session->s_state = CEPH_MDS_SESSION_RECONNECTING; session->s_state = CEPH_MDS_SESSION_RECONNECTING;
session->s_seq = 0; session->s_seq = 0;
session->s_recon_gen++;
ceph_con_open(&session->s_con, ceph_con_open(&session->s_con,
ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
......
...@@ -98,8 +98,6 @@ struct ceph_mds_session { ...@@ -98,8 +98,6 @@ struct ceph_mds_session {
u64 s_seq; /* incoming msg seq # */ u64 s_seq; /* incoming msg seq # */
struct mutex s_mutex; /* serialize session messages */ struct mutex s_mutex; /* serialize session messages */
int s_recon_gen; /* inc on reconnect to recovered mds */
struct ceph_connection s_con; struct ceph_connection s_con;
/* protected by s_cap_lock */ /* protected by s_cap_lock */
......
...@@ -171,7 +171,6 @@ struct ceph_cap { ...@@ -171,7 +171,6 @@ struct ceph_cap {
int mds_wanted; int mds_wanted;
u32 seq, issue_seq, mseq; u32 seq, issue_seq, mseq;
u32 cap_gen; /* active/stale cycle */ u32 cap_gen; /* active/stale cycle */
u32 recon_gen; /* mds restart reconnect cycle */
unsigned long last_used; unsigned long last_used;
struct list_head caps_item; struct list_head caps_item;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment