From 04189f8408f02cbd5d40c950f851e78cfcaa2052 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 Oct 2010 15:07:16 -0700 Subject: [PATCH] mds: fix can_scatter_pin() to be only SYNC and MIX Those are the only states where the replica can effectively prevent the lock from cycling in a way that would force a frozen dirfrag beneath the scatterpinned inode to update/journal something (accounted_fragstat/rstat). Signed-off-by: Sage Weil --- src/mds/Migrator.cc | 3 +++ src/mds/ScatterLock.h | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index c6e3e8907efab..3829679cd715b 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -591,6 +591,9 @@ void Migrator::export_dir(CDir *dir, int dest) CInode *diri = dir->inode; if (!diri->can_scatter_pin()) { dout(7) << "export_dir couldn't pin parent inode scatterlocks, failing. " << *diri << dendl; + + // XXX we should make some effort to move lock(s) to a state where we _can_ export! + return; } diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index ad1c0aa96b8a1..cf3751f72dc8f 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -76,7 +76,17 @@ public: } bool can_scatter_pin(client_t loner) { - return can_rdlock(-1) || can_wrlock(loner); + /* + LOCK : NOT okay because it can MIX and force replicas to journal something + TSYN : also not okay for same reason + EXCL : also not okay + + MIX : okay, replica can stall before sending AC_SYNCACK + SYNC : okay, replica can stall before sending AC_MIXACK or AC_LOCKACK + */ + return + get_state() == LOCK_SYNC || + get_state() == LOCK_MIX; } xlist::item *get_updated_item() { return &more()->item_updated; } -- 2.39.5