From: Yan, Zheng Date: Mon, 26 Aug 2019 12:30:26 +0000 (+0800) Subject: mds: Revert "properly setup client_need_snapflush for snap inode" X-Git-Tag: v14.2.5~44^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a0eee0251aaf813afe5979ebf6ee9405c414be51;p=ceph.git mds: Revert "properly setup client_need_snapflush for snap inode" This reverts commit 9fb61cd65895dbdb92cb46d24be8bf79ce57409d. That commit handle a case that cap message flushes dirty caps and releases the same same caps. MDCache::cow_inode() loses track of the released caps and does not create snap inode. Previous commit make mds track dirty snap caps as whole. Above case become "cap message releases all write caps". If client can release all wirte caps, it should have already sent all snap flush message. Conflicts: src/mds/Locker.cc Signed-off-by: "Yan, Zheng" (cherry picked from commit 06b878c5bbb6e35b8428281fc648bc2316192ae7) --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index fcd7deb93cd..c9713bcfa75 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2949,8 +2949,9 @@ void Locker::handle_client_caps(const MClientCaps::const_ref &m) dout(10) << " revocation in progress, not making any conclusions about null snapflushes" << dendl; } } + if (cap->need_snapflush() && !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP)) + cap->clear_needsnapflush(); - bool need_snapflush = cap->need_snapflush(); if (dirty && in->is_auth()) { dout(7) << " flush client." << client << " dirty " << ccap_string(dirty) << " seq " << m->get_seq() << " on " << *in << dendl; @@ -2958,12 +2959,6 @@ void Locker::handle_client_caps(const MClientCaps::const_ref &m) m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier()); ack->set_client_tid(m->get_client_tid()); ack->set_oldest_flush_tid(m->get_oldest_flush_tid()); - - // client flushes and releases caps at the same time. make sure MDCache::cow_inode() - // properly setup CInode::client_need_snapflush - if (!need_snapflush && (dirty & ~cap->issued()) && - (m->flags & MClientCaps::FLAG_PENDING_CAPSNAP)) - cap->mark_needsnapflush(); } // filter wanted based on what we could ever give out (given auth/replica status) @@ -2978,14 +2973,9 @@ void Locker::handle_client_caps(const MClientCaps::const_ref &m) adjust_cap_wanted(cap, new_wanted, m->get_issue_seq()); } - bool updated = in->is_auth() && - _do_cap_update(in, cap, dirty, follows, m, ack, &need_flush); - - if (cap->need_snapflush() && - (!need_snapflush || !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP))) - cap->clear_needsnapflush(); - - if (updated) { + if (in->is_auth() && + _do_cap_update(in, cap, dirty, follows, m, ack, &need_flush)) { + // updated eval(in, CEPH_CAP_LOCKS); if (!need_flush && (cap->wanted() & ~cap->pending()))