Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287163
b: refs/heads/master
c: d8fb02a
h: refs/heads/master
i:
  287161: f2025d8
  287159: 23a2448
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed Feb 2, 2012
1 parent ad80f4d commit 20f5b15
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 32852a81bccd9e3d1953b894966393d1b546576d
refs/heads/master: d8fb02abdc39f92a1066313e2b17047876afa8f9
4 changes: 2 additions & 2 deletions trunk/fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,10 @@ static int __cap_is_valid(struct ceph_cap *cap)
unsigned long ttl;
u32 gen;

spin_lock(&cap->session->s_cap_lock);
spin_lock(&cap->session->s_gen_ttl_lock);
gen = cap->session->s_cap_gen;
ttl = cap->session->s_cap_ttl;
spin_unlock(&cap->session->s_cap_lock);
spin_unlock(&cap->session->s_gen_ttl_lock);

if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) {
dout("__cap_is_valid %p cap %p issued %s "
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,10 @@ static int dentry_lease_is_valid(struct dentry *dentry)
di = ceph_dentry(dentry);
if (di && di->lease_session) {
s = di->lease_session;
spin_lock(&s->s_cap_lock);
spin_lock(&s->s_gen_ttl_lock);
gen = s->s_cap_gen;
ttl = s->s_cap_ttl;
spin_unlock(&s->s_cap_lock);
spin_unlock(&s->s_gen_ttl_lock);

if (di->lease_gen == gen &&
time_before(jiffies, dentry->d_time) &&
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
s->s_con.peer_name.type = CEPH_ENTITY_TYPE_MDS;
s->s_con.peer_name.num = cpu_to_le64(mds);

spin_lock_init(&s->s_cap_lock);
spin_lock_init(&s->s_gen_ttl_lock);
s->s_cap_gen = 0;
s->s_cap_ttl = 0;

spin_lock_init(&s->s_cap_lock);
s->s_renew_requested = 0;
s->s_renew_seq = 0;
INIT_LIST_HEAD(&s->s_caps);
Expand Down Expand Up @@ -2328,10 +2330,10 @@ static void handle_session(struct ceph_mds_session *session,
case CEPH_SESSION_STALE:
pr_info("mds%d caps went stale, renewing\n",
session->s_mds);
spin_lock(&session->s_cap_lock);
spin_lock(&session->s_gen_ttl_lock);
session->s_cap_gen++;
session->s_cap_ttl = 0;
spin_unlock(&session->s_cap_lock);
spin_unlock(&session->s_gen_ttl_lock);
send_renew_caps(mdsc, session);
break;

Expand Down
7 changes: 5 additions & 2 deletions trunk/fs/ceph/mds_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,13 @@ struct ceph_mds_session {
void *s_authorizer_buf, *s_authorizer_reply_buf;
size_t s_authorizer_buf_len, s_authorizer_reply_buf_len;

/* protected by s_cap_lock */
spinlock_t s_cap_lock;
/* protected by s_gen_ttl_lock */
spinlock_t s_gen_ttl_lock;
u32 s_cap_gen; /* inc each time we get mds stale msg */
unsigned long s_cap_ttl; /* when session caps expire */

/* protected by s_cap_lock */
spinlock_t s_cap_lock;
struct list_head s_caps; /* all caps issued by this session */
int s_nr_caps, s_trim_caps;
int s_num_cap_releases;
Expand Down

0 comments on commit 20f5b15

Please sign in to comment.