ceph: avoid picking MDS that is not active

Ignore replication or auth frag data if it indicates an MDS that is not
active. This can happen if the MDS shuts down and the client has stale
data about the namespace distribution across the MDS cluster. If that's
the case, fall back to directing the request based on the auth cap (which
should always be accurate).

Signed-off-by: Sage Weil <sage@newdream.net>

Sage Weil d66bbd44 7e57b81c

+7 -3
+7 -3
fs/ceph/mds_client.c
··· 693 693 dout("choose_mds %p %llx.%llx " 694 694 "frag %u mds%d (%d/%d)\n", 695 695 inode, ceph_vinop(inode), 696 - frag.frag, frag.mds, 696 + frag.frag, mds, 697 697 (int)r, frag.ndist); 698 - return mds; 698 + if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >= 699 + CEPH_MDS_STATE_ACTIVE) 700 + return mds; 699 701 } 700 702 701 703 /* since this file/dir wasn't known to be ··· 710 708 dout("choose_mds %p %llx.%llx " 711 709 "frag %u mds%d (auth)\n", 712 710 inode, ceph_vinop(inode), frag.frag, mds); 713 - return mds; 711 + if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >= 712 + CEPH_MDS_STATE_ACTIVE) 713 + return mds; 714 714 } 715 715 } 716 716 }