From 06b878c5bbb6e35b8428281fc648bc2316192ae7 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 26 Aug 2019 20:30:26 +0800 Subject: [PATCH] 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" --- src/mds/Locker.cc | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 7515b6a76fc..cdc985a2de4 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2954,8 +2954,9 @@ void Locker::handle_client_caps(const cref_t &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; @@ -2963,12 +2964,6 @@ void Locker::handle_client_caps(const cref_t &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) @@ -2983,14 +2978,9 @@ void Locker::handle_client_caps(const cref_t &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())) -- 2.39.5