From: Yan, Zheng Date: Fri, 21 Feb 2014 02:13:00 +0000 (+0800) Subject: client: remove exported caps when handling cap import message X-Git-Tag: v0.79~179^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ddc951be0c836608ca01202cd0e1f7727762ad1;p=ceph.git client: remove exported caps when handling cap import message Version 3 cap import message includes the ID of the exported caps. It allow us to remove the exported caps if we still haven't received the corresponding cap export message. We remove the exported caps because they are stale, keeping them can compromise consistence. Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 21e1eea42aae..9ff6d016d85c 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3496,11 +3496,22 @@ void Client::handle_cap_import(MetaSession *session, Inode *in, MClientCaps *m) { int mds = session->mds_num; + ldout(cct, 5) << "handle_cap_import ino " << m->get_ino() << " mseq " << m->get_mseq() + << " IMPORT from mds." << mds << dendl; + // add/update it update_snap_trace(m->snapbl); add_update_cap(in, session, m->get_cap_id(), m->get_caps(), m->get_seq(), m->get_mseq(), m->get_realm(), CEPH_CAP_FLAG_AUTH); + + if (m->peer.cap_id) { + Cap *cap = in->caps[m->peer.mds]; + if (cap && cap->cap_id == m->peer.cap_id) { + in->exporting_issued = cap->issued; + remove_cap(cap, (m->peer.flags & CEPH_CAP_FLAG_RELEASE)); + } + } if (in->auth_cap && in->auth_cap->session->mds_num == mds) { // reflush any/all caps (if we are now the auth_cap) @@ -3509,21 +3520,6 @@ void Client::handle_cap_import(MetaSession *session, Inode *in, MClientCaps *m) if (in->flushing_caps) flush_caps(in, session); } - - if (m->get_mseq() > in->exporting_mseq) { - ldout(cct, 5) << "handle_cap_import ino " << m->get_ino() << " mseq " << m->get_mseq() - << " IMPORT from mds." << mds - << ", clearing exporting_issued " << ccap_string(in->exporting_issued) - << " mseq " << in->exporting_mseq << dendl; - in->exporting_issued = 0; - in->exporting_mseq = 0; - in->exporting_mds = -1; - } else { - ldout(cct, 5) << "handle_cap_import ino " << m->get_ino() << " mseq " << m->get_mseq() - << " IMPORT from mds." << mds - << ", keeping exporting_issued " << ccap_string(in->exporting_issued) - << " mseq " << in->exporting_mseq << " by mds." << in->exporting_mds << dendl; - } } void Client::handle_cap_export(MetaSession *session, Inode *in, MClientCaps *m)