mds: allow fragmenting subtree dirfrags

We can't wait until object becomes auth pinnable after freezing a
dirfrag/subtree, because it can cause deadlock. Current fragmenting
dirfrag code checks if the directory inode is auth pinnable, then
calls Locker::acquire_locks(). It avoids deadlock, but also forbids
fragmenting subtree dirfrags. We can get rid of the limitation by
using 'nonlocking auth pin' mode of Locker::acquire_locks().

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: journal dirfragtree change

Introduce new flag DIRTYDFT to CDir and EMetaBlob::dirlump, the new
flag indicates the dirfrag is newly fragmented and the corresponding
dirfragtree change hasn't been propagate to the directory inode.

After fragmenting subtree dirfrags, make sure DIRTYDFT flag is set
on EMetaBlob::dirlump that correspond to the resulting dirfrags.
Journal replay code uses DIRTYDFT frag to decide if dirfragtree is
scattered dirty.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix 'force dirfrags' during journal replay

For rename operation, null dentry is first replayed, it detaches
the inode from the FS hierarchy. Then primary dentry is replayed,
it updates the inode and re-attaches the inode to the FS hierarchy.
We may call CInode::force_dirfrag() when updating the inode. But
CInode::force_dirfrag() doesn't work well when inode is detached
from the FS hierarchy because adjusting fragments may also adjust
subtree map. The fix is don't detach the inode when replaying the
null dentry.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: force fragment subtree bounds when replaying ESubtreeMap

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fixes for thrash fragment

This patch contains 3 changes:
- limit the number of in progress fragmenting processes.
- reduce the probability of splitting small dirfrag.
- process the merge_queue when thrash_fragments is enabled.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix scattered wrlock rejoin

If unstable scatter lock is encountered when handling weak cache
rejoin, don't remove the recovering MDS from the scatter lock's
gather list. The reason is the recovering MDS may hold rejoined
wrlock on the scatter lock. (Rejoined wrlocks were created when
handling strong cache rejoins from survivor MDS)

When composing cache rejoin ack, if the recovering MDS is in lock's
gather list, set lock state of the recovering MDS to a compatible
unstable stable.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: avoid race between cache expire and pushing replicas

MDentryLink and MMDSFragmentNotify push replica inode/dirfrags
to other MDS. They both are racy because, when the target MDS
receives them, it may has expired the replicaed inode/dirfrags'
ancestor. The race creates unconnected replica inode/dirfrags,
unconnected replicas are problematic for subtree migration
because migrator sends MExportDirNotify according to subtree
dirfrag's replica list. MDS that contains unconnected replicas
may not receive MExportDirNotify.

The fix is, for MDentryLink and MMDSFragmentNotify messages
that may be received later, we avoid trimming their parent
replica objects. If null replica dentry is not readable, we
may receive a MDentryLink message later. If replica inode's
dirfragtreelock is not readable, it's likely some dirfrags
of the inode are being fragmented, we may receive a
MMDSFragmentNotify message later.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix negative rstat assertion

when gathering rstat for directory inode that is fragmented to
several dirfrags, inode's rstat may temporarily become nagtive.
This is because, when splitting dirfrag, delta rstat is always
added to the first new dirfrag.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: wake up dentry waiters when handling cache rejoin ack

Cache rejoin ack message may fragment dirfrag, we should set the
'replay' parameter of adjust_dir_fragments() to false in this case.
This makes sure that CDir::merge/split wake up any dentry waiter
in the fragmented dirfrag.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: remove failed MDS from export bystanders list

make sure the importer does not wait for MExportDirNotifyAck from
the failed MDS

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix slave rename rollback

use rollback bufferlist to decide if the inode is being exported.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: open sessions for rejoin imported caps

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
osd/ReplicatedPG: allow is_degraded_object() to be called outside of backfil

The agent does this.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: bump the protocol version

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
qa/workunits/suites/pjd: use test suite with acl tweak

Test 45 in xacl/00.t fails on ext4 and cephfs.  Just disable it.
Everything else passes.

Signed-off-by: Sage Weil <sage@inktank.com>
client: don't populate Client::barriers from read accesses

If the entry doesn't exist, no need to create it.

Signed-off-by: Sage Weil <sage@inktank.com>
client/barrier: drop unused active_commit_interval

Signed-off-by: Sage Weil <sage@inktank.com>
client: fix barrier interval

(start, end) not (start, length)

Signed-off-by: Sage Weil <sage@inktank.com>
client: disable barrier support

The boost interval_set class is not available on centos6/rhel6.  Until that
dependency is sorted out, fix the build.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'gh/wip-7212-sage-b'

We should carefully backport some or all of this.

Backport: emperor, dumpling
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>