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