ceph: fix mds cluster availability check
authorYan, Zheng <zyan@redhat.com>
Wed, 4 Jan 2017 08:21:58 +0000 (16:21 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 12 Jan 2017 18:31:01 +0000 (19:31 +0100)
We should apply the check after getting the initial mdsmap.

Fixes: e9e427f0a14f ("ceph: check availability of mds cluster on mount")
Link: http://tracker.ceph.com/issues/18161
Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/mds_client.c

index 4f49253387a0a59d238a041b1ec8fc9fd7185c40..ec6b35e9f966bfae46e69dfcaffee2769d699bfd 100644 (file)
@@ -2106,6 +2106,11 @@ static int __do_request(struct ceph_mds_client *mdsc,
                        dout("do_request mdsmap err %d\n", err);
                        goto finish;
                }
+               if (mdsc->mdsmap->m_epoch == 0) {
+                       dout("do_request no mdsmap, waiting for map\n");
+                       list_add(&req->r_wait, &mdsc->waiting_for_map);
+                       goto finish;
+               }
                if (!(mdsc->fsc->mount_options->flags &
                      CEPH_MOUNT_OPT_MOUNTWAIT) &&
                    !ceph_mdsmap_is_cluster_available(mdsc->mdsmap)) {