mds: Don't drop client request from MDS

MDS may send client request for stray migration/reintegration.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Consider stopping MDS when finding peer inode

To migrate strays, the receiving MDS need find stopping MDS' mdsdir

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Add finish callback to waiting_for_base_ino wait queue

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Allow rename request for stray migration/reintegration

Allow rename request to modify system directory if it is for stray
migration/reintegration.

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

Xlock imports and capability imports are uncorrelated, we should call
xlock_import() even there is no capability import.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Set metablob.renamed_dirino in do_rename_rollback()

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Avoid save unnecessary parent snaprealm

We can avoid save parent snaprealm if current_parent_since is greater
than parent snaprealm's newest sequence.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Allow export subtrees in other MDS' stray directory

Stray migration is implemented by rename, it may create auth subtrees
in other MDS' stray directory.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Properly update dirty dir fragstat during log replay

Dirty dir fragstat is managed by filelock instead of nestlock.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Trim non auth subtree directory

Trim non auth subtree directory if all its dentries were trimmed
and it's not bound of auth subtree.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Properly re-calculate mdsdir inode's auth bit

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: Avoid creating unnecessary snaprealm

When moving directory between snaprealms, we can avoid creating snaprealm
if the directory doesn't has its own snaprealm and directory was created
after both realms' newest snapshot.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix stray reintegration check in handle_client_rename

The stray reintegration generates a source path that will be rooted in a
(possibly remote) MDS's MDSDIR; adjust this check accordingly.  This is a
holdover from way back when the straydir was the base of the tree instead
of mdsdir.

Reported-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
doc: update release-process.rst

Signed-off-by: Sage Weil <sage@inktank.com>
mds: make migrate_stray() specify full path

The handle_client_rename() check expects a full path rooted in the MDSDIR.
Do so in migrate_stray().

Also, use the committed (not projected) dn linkage; this was a carry-over
from the original switch to this API forever ago, but the current callers
don't need to migrate an uncommitted stray.  This also aligns us with
reintegrate_stray().

Reported-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
ceph-fuse: Test for fuse cache issue (#2215)

Signed-off-by: Sam Lang <sam.lang@inktank.com>
client: Remove unnecessary checkafter parameter

The logic in put_cap_ref doesn't do anything but inode->put_cap_ref
if cap is set to CEPH_CAP_FILE_CACHE, so checkafter isn't needed.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
client: Fix #2215 with cache inval in thread

The client currently deadlocks with kernel buffer cache invalidation
enabled, due to the client lock calling the invalidate callback, which
in turn sends up calls back to the userspace process which try to lock
the same client lock.  The fix is to invoke the invalidate callback in
a separate thread, allowing _release, _flushed, etc. to complete,
unlocking the client lock so that the invalidate callback avoids deadlock
when the up call is made.

We construct a separate work queue (Finisher) that allows scheduling
the invalidate callbacks in a separate thread.  The thread only starts
when the invalidate callback is set.  If no callback is set, the cache
capability reference is decremented inline as before.

Some callers of invalidate_inode_cache (flush and update_inode_file_bits)
don't expect the cache capability to be decremented.  Pass a keep_caps flag to
only decrement the capability ref in the _release case.

Also, we need to make sure the mds is aware that the client has dropped
the cache capability, so we add a call to check_caps in put_cap_ref for the
CEPH_CAP_FILE_CACHE capability.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Merge branch 'wip-mds'