client: fix race between cap issue and revoke

If we receive new caps from the auth MDS and the non-auth MDS is
revoking the newly issued caps, we should release the caps from
the non-auth MDS. The scenario is filelock's state changes from
SYNC to LOCK. Non-auth MDS revokes Fc cap, the client gets Fc cap
from the auth MDS at the same time.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: clear migrate seq when MDS restarts

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: don't send cap release when removing exported cap

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: use ceph_seq_cmp() to compare cap seq/mseq

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: remove exported caps when handling cap import message

Version 3 cap import message includes the ID of the exported
caps. It allow us to remove the exported caps if we still haven't
received the corresponding cap export message.

We remove the exported caps because they are stale, keeping them
can compromise consistence.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: add imported caps when handling cap export message

Version 3 cap export message includes information about the imported
caps. It allows us to add the imported caps if the corresponding cap
import message still hasn't been received.

This allow us to handle situation that the importer MDS crashes and
the cap import message is missing.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: put flushing inode to proper list when auth mds changes

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: check inode's cap when looking up dentry

Some inodes in readdir reply may have no caps. Getattr mds request
for these inodes can return -ESTALE. The fix is consider dentry that
links to inode with no caps as invalid. Invalid dentry causes a
lookup request to send to the mds, the MDS will send caps back.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: choose hash function according to dir layout

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