Skip to content

Commit

Permalink
ceph: reset requested max_size after mds reconnect
Browse files Browse the repository at this point in the history
The max_size increase request to the MDS can get lost during an MDS
restart and reconnect.  Reset our requested value after the MDS recovers,
so that any blocked writes will re-request a larger max_size upon waking.

Also, explicit wake session caps after the reconnect.  Normally the cap
renewal catches this, but not in the cases where the caps didn't go stale
in the first place, which would leave writers waiting on max_size asleep.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Nov 20, 2009
1 parent dc14657 commit 0dc2570
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,14 +746,24 @@ static void remove_session_caps(struct ceph_mds_session *session)
static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
void *arg)
{
wake_up(&ceph_inode(inode)->i_cap_wq);
struct ceph_inode_info *ci = ceph_inode(inode);

wake_up(&ci->i_cap_wq);
if (arg) {
spin_lock(&inode->i_lock);
ci->i_wanted_max_size = 0;
ci->i_requested_max_size = 0;
spin_unlock(&inode->i_lock);
}
return 0;
}

static void wake_up_session_caps(struct ceph_mds_session *session)
static void wake_up_session_caps(struct ceph_mds_session *session,
int reconnect)
{
dout("wake_up_session_caps %p mds%d\n", session, session->s_mds);
iterate_session_caps(session, wake_up_session_cb, NULL);
iterate_session_caps(session, wake_up_session_cb,
(void *)(unsigned long)reconnect);
}

/*
Expand Down Expand Up @@ -794,6 +804,8 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,

/*
* Note new cap ttl, and any transition from stale -> not stale (fresh?).
*
* Called under session->s_mutex
*/
static void renewed_caps(struct ceph_mds_client *mdsc,
struct ceph_mds_session *session, int is_renew)
Expand Down Expand Up @@ -822,7 +834,7 @@ static void renewed_caps(struct ceph_mds_client *mdsc,
spin_unlock(&session->s_cap_lock);

if (wake)
wake_up_session_caps(session);
wake_up_session_caps(session, 0);
}

/*
Expand Down Expand Up @@ -2248,6 +2260,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,
pr_info("mds%d reconnect completed\n", s->s_mds);
kick_requests(mdsc, i, 1);
ceph_kick_flushing_caps(mdsc, s);
wake_up_session_caps(s, 1);
}
}
}
Expand Down

0 comments on commit 0dc2570

Please sign in to comment.