mds: journal EImportFinish after adjusting subtree auth

Submitting EImportFinish may journal an extra ESubtreeMap as side
effect. The ESubtreeMap should reflects subtree state after import
is finished.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: include all of directory inode's replicas in rmdir witnesses

If a MDS crashed after journaling a rmdir operation, but before sending
MDentryUnlink messages. Survivor MDS may have incorrect linkage for the
removed directory. Later when the MDS recovers, the incorrect linkage
can cause survivor MDS crash.

The fix is include all of directory inode's replicas in rmdir witnesses
list. When receiving a rmdir slave request, MDS who has no auth subtree
in the directory only need to update its cache and send reply (doesn't
need to journal the slave request).

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: skip journaling slave rename when possible

Rename operation can affect three dentries and two inodes. For MDS
who receives rename slave request, but isn't authority of any of
these dentries/inodes and doesn't have any auth subtree under these
dentries/inodes, journaling slave rename can be skipped.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: allow early reply when there is no journaled slave update

Early reply should be Ok when there were slave requests, but none
of them modifies any object.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: journal rename source inode when rollback rename

rename changes the source inode's ctime. rollback changes ctime back
to its original value.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: try trimming exported objects

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: drop locks after removing import/export state

dropping locks can dispatch requests, which may export the same
dirfrag again.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix remote auth pin race

When removing auth unpinned objects from mdr->remote_auth_pins,
Server::handle_slave_auth_pin() checks object's authority to decide
if the object was auth pinned by a given MDS. This method isn't
reliable because when object isn't auth pinned, its authority may
change.

The fix is remember from which MDS an objects was auth pinned.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: queue waiters in MDCache::force_dir_fragment()

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: include timestamp in MClientRequest

Signed-off-by: Sage Weil <sage@inktank.com>
client: set timestamp in MDS requests

Signed-off-by: Sage Weil <sage@inktank.com>
mds: add {mds,op}_stamp to Mutation

With getters, setters.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: set mds_stamp on lock acquisition

Normally acquire_locks() will set this for us.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: make sure mds_stamp is set when we journal

This is a catch-all that we are carrying over from before.  It may not
be strictly necessary, but I'm not inclined to check the code for
Mutation users who didn't call acquire_locks().

Signed-off-by: Sage Weil <sage@inktank.com>
mds: do rstat timestamps (rctime, fragstat mtime) in terms of op stamp

Use the op (client) timestamp for the recursive stats, for santity's sake.
Note that since this is monotonically increasing, the danger here is
that we lose track of nested changes due to skewed client clocks.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: do the balancer and propagation timers based on mds_stmap

Use the (more) stable time stamp for doing the balancer's temperature
tracking and associated decay.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: use client-provided time stamp for user-visible file metadata

Use the op_stamp from the MDRequest, populated by the MClientRequest when
possible, for setting timestamps on user-visible metadata (like ctime,
mtime).

Signed-off-by: Sage Weil <sage@inktank.com>
mds: use real timestamp for readdir leases

Signed-off-by: Sage Weil <sage@inktank.com>
mds: reset mds_stamp for readdir, rename, link

These ops to complicated work prior to starting the real operation, like
fetching missing directories, or opening remote dirfrags, creating
snaprealms.  Reset the mds timestamp after this slow work has completed.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: use mds_stamp for mksnap

Use the server timestamp for the snapshot timestamp.  This could arguably
be the client timestamp, but I think snapshot creation times are a bit
more important to have accurate timestamps on, and this should not be
something that existing client apps will strongly depend on.

Signed-off-by: Sage Weil <sage@inktank.com>