diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-11-10 16:02:06 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-12-12 23:54:27 +0100 |
commit | e9e427f0a14f7e4773896dd7af357819a56d097a (patch) | |
tree | 0dc4cbb9e97788412760a6d03d86b0967e655db4 /fs/ceph/mds_client.c | |
parent | 7ce469a53e7106acdaca2e25027941d0f7c12a8e (diff) | |
download | lwn-e9e427f0a14f7e4773896dd7af357819a56d097a.tar.gz lwn-e9e427f0a14f7e4773896dd7af357819a56d097a.zip |
ceph: check availability of mds cluster on mount
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index bf4d3d26850c..4f49253387a0 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2100,17 +2100,26 @@ static int __do_request(struct ceph_mds_client *mdsc, err = -EIO; goto finish; } + if (ACCESS_ONCE(mdsc->fsc->mount_state) == CEPH_MOUNT_MOUNTING) { + if (mdsc->mdsmap_err) { + err = mdsc->mdsmap_err; + dout("do_request mdsmap err %d\n", err); + goto finish; + } + if (!(mdsc->fsc->mount_options->flags & + CEPH_MOUNT_OPT_MOUNTWAIT) && + !ceph_mdsmap_is_cluster_available(mdsc->mdsmap)) { + err = -ENOENT; + pr_info("probably no mds server is up\n"); + goto finish; + } + } put_request_session(req); mds = __choose_mds(mdsc, req); if (mds < 0 || ceph_mdsmap_get_state(mdsc->mdsmap, mds) < CEPH_MDS_STATE_ACTIVE) { - if (mdsc->mdsmap_err) { - err = mdsc->mdsmap_err; - dout("do_request mdsmap err %d\n", err); - goto finish; - } dout("do_request no mds or not active, waiting for map\n"); list_add(&req->r_wait, &mdsc->waiting_for_map); goto out; |