From: Yan, Zheng Date: Thu, 20 Feb 2014 07:31:40 +0000 (+0800) Subject: client: check mds_wanted for imported cap X-Git-Tag: v0.79~179^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5c55eb106f57d64b0e500a91d742ce38b6a93f1a;p=ceph.git client: check mds_wanted for imported cap The MDS may have incorrect wanted caps after importing caps. So the client should check the value mds has and send cap update if necessary. Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 248e54f72b9c..9de24bb8116e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2507,6 +2507,10 @@ void Client::check_caps(Inode *in, bool is_delayed) goto ack; } + /* want more caps from mds? */ + if (wanted & ~(cap->wanted | cap->issued)) + goto ack; + if (!revoking && unmounting && (cap_used == 0)) goto ack; @@ -3681,6 +3685,7 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient { int mds = session->mds_num; int used = in->caps_used(); + int wanted = in->caps_wanted(); const int old_caps = cap->issued; const int new_caps = m->get_caps(); @@ -3731,6 +3736,10 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient } } + bool check = false; + if (m->get_op() == CEPH_CAP_OP_IMPORT && m->get_wanted() != wanted) { + check = true; + check_cap_issue(in, cap, issued); // update caps @@ -3747,7 +3756,7 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient // waitin' for flush } else { cap->wanted = 0; // don't let check_caps skip sending a response to MDS - check_caps(in, true); + check = true; } } else if (old_caps == new_caps) { @@ -3758,6 +3767,9 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient cap->implemented |= new_caps; } + if (check) + check_caps(in, true); + // wake up waiters if (new_caps) signal_cond_list(in->waitfor_caps);