diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-11-22 01:21:44 -0500 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2014-01-21 00:29:33 -0500 |
commit | ca18bede048e95a749d13410ce1da4ad0ffa7938 (patch) | |
tree | c184b060bfb8e7b5393544bfbbd581077025ed76 /fs/ceph | |
parent | 979abfdd5c7ca4abe3f0157a6ea9bfef41114c89 (diff) |
ceph: handle -ESTALE reply
Send requests that operate on path to directory's auth MDS if
mode == USE_AUTH_MDS. Always retry using the auth MDS if got
-ESTALE reply from non-auth MDS. Also clean up the code that
handles auth MDS change.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/mds_client.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 73c79431cbff..1fd655ac806a 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -713,14 +713,15 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
713 | struct dentry *dn = get_nonsnap_parent(parent); | 713 | struct dentry *dn = get_nonsnap_parent(parent); |
714 | inode = dn->d_inode; | 714 | inode = dn->d_inode; |
715 | dout("__choose_mds using nonsnap parent %p\n", inode); | 715 | dout("__choose_mds using nonsnap parent %p\n", inode); |
716 | } else if (req->r_dentry->d_inode) { | 716 | } else { |
717 | /* dentry target */ | 717 | /* dentry target */ |
718 | inode = req->r_dentry->d_inode; | 718 | inode = req->r_dentry->d_inode; |
719 | } else { | 719 | if (!inode || mode == USE_AUTH_MDS) { |
720 | /* dir + name */ | 720 | /* dir + name */ |
721 | inode = dir; | 721 | inode = dir; |
722 | hash = ceph_dentry_hash(dir, req->r_dentry); | 722 | hash = ceph_dentry_hash(dir, req->r_dentry); |
723 | is_hash = true; | 723 | is_hash = true; |
724 | } | ||
724 | } | 725 | } |
725 | } | 726 | } |
726 | 727 | ||
@@ -2161,26 +2162,16 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
2161 | */ | 2162 | */ |
2162 | if (result == -ESTALE) { | 2163 | if (result == -ESTALE) { |
2163 | dout("got ESTALE on request %llu", req->r_tid); | 2164 | dout("got ESTALE on request %llu", req->r_tid); |
2164 | if (!req->r_inode) { | 2165 | if (req->r_direct_mode != USE_AUTH_MDS) { |
2165 | /* do nothing; not an authority problem */ | ||
2166 | } else if (req->r_direct_mode != USE_AUTH_MDS) { | ||
2167 | dout("not using auth, setting for that now"); | 2166 | dout("not using auth, setting for that now"); |
2168 | req->r_direct_mode = USE_AUTH_MDS; | 2167 | req->r_direct_mode = USE_AUTH_MDS; |
2169 | __do_request(mdsc, req); | 2168 | __do_request(mdsc, req); |
2170 | mutex_unlock(&mdsc->mutex); | 2169 | mutex_unlock(&mdsc->mutex); |
2171 | goto out; | 2170 | goto out; |
2172 | } else { | 2171 | } else { |
2173 | struct ceph_inode_info *ci = ceph_inode(req->r_inode); | 2172 | int mds = __choose_mds(mdsc, req); |
2174 | struct ceph_cap *cap = NULL; | 2173 | if (mds >= 0 && mds != req->r_session->s_mds) { |
2175 | 2174 | dout("but auth changed, so resending"); | |
2176 | if (req->r_session) | ||
2177 | cap = ceph_get_cap_for_mds(ci, | ||
2178 | req->r_session->s_mds); | ||
2179 | |||
2180 | dout("already using auth"); | ||
2181 | if ((!cap || cap != ci->i_auth_cap) || | ||
2182 | (cap->mseq != req->r_sent_on_mseq)) { | ||
2183 | dout("but cap changed, so resending"); | ||
2184 | __do_request(mdsc, req); | 2175 | __do_request(mdsc, req); |
2185 | mutex_unlock(&mdsc->mutex); | 2176 | mutex_unlock(&mdsc->mutex); |
2186 | goto out; | 2177 | goto out; |