mds: disallow write operations when MDS is readonly

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: don't trim log when MDS is readonly

When MDS is readonly, keep metadata objects (not include the journal) of
cephfs unchanged. This allows us to submit new entries to the log while
MDS is readonly. (Log entries submitted after MDS becomes readonly can
be safely dropped)

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: keep locks in sync state when MDS is readonly

when transit locks to sync state, we may submit new entries to the log.
This should be safe as long as we don't trim old log segments.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: disallow slave requests when MDS is readonly

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: disable misc internal activitiles when MDS is readonly

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: disallow reconnectiong to readonly MDS

this force reconnecting clients to drop any write caps.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: add helper to force MDS readonly

the helper function marks MDS readonly, then revokes write caps from
clients.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: notify clients when MDS goes to readonly

notice clients that MDS goes to readonly and MDS won't issue write
caps any more.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
client: handle MDS 'force readonly' message

make client return -EROFS for write when MDS is readonly, instead of
waiting forever.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: add asok command to force MDS readonly

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: allow choosing action for wirte error

Signed-off-by: Yan, Zheng <zyan@redhat.com>
mds: don't blindly create empty object when dirfrag is missing

mark the corresponding CDir as bad instead.

Signed-off-by: Yan, Zheng <zyan@redhat.com>