mds: fix how to preserve COMPLETE flag for fragment rollback

commit 6e013cd6 (properly set COMPLETE flag when merging dirfrags)
tries solving the issue that new dirfrag's COMPLETE flag gets lost
if the dirfrag gets fragmented, then the fragment operation gets
rolled back. It records if the original dirfrag is complete when
EFragment::OP_PREPARE event is encountered. If the fragment operation
is rolled back later, The complete flag is journaled in corresponding
EFragment::OP_ROLLBACK event. This is problematic when the PREPARE
and ROLLBACK events are in different log segments. The dirfrag can be
not complete if only the ROLLBACK event exists (the log segment that
contains PREPARE event is trimmed)

The fix is do not journal the complete flag in ROLLBACK event. The
COMPLETE flag is saved when replaying EFragment::PREPARE event. Later
when the EFragment::ROLLBACK event is encountered, COMPLETE flag is
restored.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: properly journal fragment rollback

If dirfrags are subtree roots, mark the dirfragtreelock as scattered
dirty, otherwise journal the dirfragtree change.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: trim non-auth inode with remote parents

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: trim empty non-auth dirfrags

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix CInode::get_approx_dirfrag

return NULL if there is no opened dirfrag

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: journal EFragment::OP_COMMIT before drop locks

Dropping locks can dispatch other requests. These request can submit
log entry.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix null pointer dereference in MDCache::rejoin_send_rejoins()

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: skip non-opened session when flushing client sessions

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