From: Yan, Zheng Date: Fri, 5 Jan 2018 01:25:43 +0000 (+0800) Subject: mds: ignore MClientCaps::FLAG_NO_CAPSNAP X-Git-Tag: v13.0.2~400^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=626e42b81740c6697067de8587750f159df47378;p=ceph.git mds: ignore MClientCaps::FLAG_NO_CAPSNAP checking the flags is racy because client may create cap snap after sending cap message Signed-off-by: "Yan, Zheng" --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 4c296f76aba..d0e2b9b37f4 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3296,9 +3296,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap, m->change_attr = in->change_attr; if (sync) m->flags |= MClientCaps::FLAG_SYNC; - if (in->cap_snaps.empty()) - m->flags |= MClientCaps::FLAG_NO_CAPSNAP; - else + if (!in->cap_snaps.empty()) m->flags |= MClientCaps::FLAG_PENDING_CAPSNAP; if (flush & CEPH_CAP_FILE_WR) { diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 018c6333d1b..df65779239f 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2883,9 +2883,8 @@ void Locker::handle_client_caps(MClientCaps *m) // released all WR/EXCL caps (the FLUSHSNAP always comes before the cap // update/release). if (!head_in->client_need_snapflush.empty()) { - if ((m->flags & MClientCaps::FLAG_NO_CAPSNAP) || - (!(cap->issued() & CEPH_CAP_ANY_FILE_WR) && - !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP))) { + if (!(cap->issued() & CEPH_CAP_ANY_FILE_WR) && + !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP)) { head_in->auth_pin(this); // prevent subtree frozen need_unpin = true; _do_null_snapflush(head_in, client); @@ -2893,7 +2892,7 @@ void Locker::handle_client_caps(MClientCaps *m) dout(10) << " revocation in progress, not making any conclusions about null snapflushes" << dendl; } } - if (cap->need_snapflush() && (m->flags & MClientCaps::FLAG_NO_CAPSNAP)) + if (cap->need_snapflush() && !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP)) cap->clear_needsnapflush(); if (m->get_dirty() && in->is_auth()) { diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index acc6242ccf7..f57797e641e 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -24,7 +24,7 @@ class MClientCaps : public Message { public: static const unsigned FLAG_SYNC = (1<<0); - static const unsigned FLAG_NO_CAPSNAP = (1<<1); + static const unsigned FLAG_NO_CAPSNAP = (1<<1); // unused static const unsigned FLAG_PENDING_CAPSNAP = (1<<2); struct ceph_mds_caps_head head;