diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-12 20:48:11 -0500 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 11:47:45 -0400 |
commit | 1ce208a6ce030ea6ccd4b13c8cec0a84c0c7a1e9 (patch) | |
tree | 2957ff4c5c853464fdd174a431a55a66924d6f79 /fs/ceph | |
parent | 182fac2689b769a96e7fc9defcd560c5cca92b1e (diff) |
ceph: don't reset s_cap_ttl to zero
Avoid the need to check for a special zero s_cap_ttl value by just
using (jiffies - 1) as the value assigned to indicate "sometime in
the past."
Signed-off-by: Alex Elder <elder@dreamhost.com>
Reviewed-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/mds_client.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 866e8d7ca37d..89971e137aab 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -402,7 +402,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, | |||
402 | 402 | ||
403 | spin_lock_init(&s->s_gen_ttl_lock); | 403 | spin_lock_init(&s->s_gen_ttl_lock); |
404 | s->s_cap_gen = 0; | 404 | s->s_cap_gen = 0; |
405 | s->s_cap_ttl = 0; | 405 | s->s_cap_ttl = jiffies - 1; |
406 | 406 | ||
407 | spin_lock_init(&s->s_cap_lock); | 407 | spin_lock_init(&s->s_cap_lock); |
408 | s->s_renew_requested = 0; | 408 | s->s_renew_requested = 0; |
@@ -1083,8 +1083,7 @@ static void renewed_caps(struct ceph_mds_client *mdsc, | |||
1083 | int wake = 0; | 1083 | int wake = 0; |
1084 | 1084 | ||
1085 | spin_lock(&session->s_cap_lock); | 1085 | spin_lock(&session->s_cap_lock); |
1086 | was_stale = is_renew && (session->s_cap_ttl == 0 || | 1086 | was_stale = is_renew && time_after_eq(jiffies, session->s_cap_ttl); |
1087 | time_after_eq(jiffies, session->s_cap_ttl)); | ||
1088 | 1087 | ||
1089 | session->s_cap_ttl = session->s_renew_requested + | 1088 | session->s_cap_ttl = session->s_renew_requested + |
1090 | mdsc->mdsmap->m_session_timeout*HZ; | 1089 | mdsc->mdsmap->m_session_timeout*HZ; |
@@ -2332,7 +2331,7 @@ static void handle_session(struct ceph_mds_session *session, | |||
2332 | session->s_mds); | 2331 | session->s_mds); |
2333 | spin_lock(&session->s_gen_ttl_lock); | 2332 | spin_lock(&session->s_gen_ttl_lock); |
2334 | session->s_cap_gen++; | 2333 | session->s_cap_gen++; |
2335 | session->s_cap_ttl = 0; | 2334 | session->s_cap_ttl = jiffies - 1; |
2336 | spin_unlock(&session->s_gen_ttl_lock); | 2335 | spin_unlock(&session->s_gen_ttl_lock); |
2337 | send_renew_caps(mdsc, session); | 2336 | send_renew_caps(mdsc, session); |
2338 | break; | 2337 | break; |