Skip to content

Commit d66bbd4

Browse files
committed
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>
1 parent 7e57b81 commit d66bbd4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎fs/ceph/mds_client.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,11 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
693693
dout("choose_mds %p %llx.%llx "
694694
"frag %u mds%d (%d/%d)\n",
695695
inode, ceph_vinop(inode),
696-
frag.frag, frag.mds,
696+
frag.frag, mds,
697697
(int)r, frag.ndist);
698-
return mds;
698+
if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
699+
CEPH_MDS_STATE_ACTIVE)
700+
return mds;
699701
}
700702

701703
/* since this file/dir wasn't known to be
@@ -708,7 +710,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
708710
dout("choose_mds %p %llx.%llx "
709711
"frag %u mds%d (auth)\n",
710712
inode, ceph_vinop(inode), frag.frag, mds);
711-
return mds;
713+
if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
714+
CEPH_MDS_STATE_ACTIVE)
715+
return mds;
712716
}
713717
}
714718
}

0 commit comments

Comments
 (0)