aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mdsmap.c
diff options
context:
space:
mode:
authorXiubo Li <xiubli@redhat.com>2021-08-18 09:31:19 +0800
committerIlya Dryomov <idryomov@gmail.com>2021-09-02 22:49:17 +0200
commitd517b3983dd3106ca92d6c5d0d09415a4a09481c (patch)
tree91e166fe30149dd653a64b60a65ab84e175a8670 /fs/ceph/mdsmap.c
parentceph: print more information when we can't find snaprealm (diff)
downloadlinux-dev-d517b3983dd3106ca92d6c5d0d09415a4a09481c.tar.xz
linux-dev-d517b3983dd3106ca92d6c5d0d09415a4a09481c.zip
ceph: reconnect to the export targets on new mdsmaps
In the case where the export MDS has crashed just after the EImportStart journal is flushed, a standby MDS takes over for it and when replaying the EImportStart journal the MDS will wait the client to reconnect. That may never happen because the client may not have registered or opened the sessions yet. When receiving a new map, ensure we reconnect to valid export targets as well if their sessions don't exist yet. Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r--fs/ceph/mdsmap.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 3c444b9cb17b..61d67cbcb367 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -122,6 +122,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
int err;
u8 mdsmap_v;
u16 mdsmap_ev;
+ u32 target;
m = kzalloc(sizeof(*m), GFP_NOFS);
if (!m)
@@ -260,9 +261,14 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
sizeof(u32), GFP_NOFS);
if (!info->export_targets)
goto nomem;
- for (j = 0; j < num_export_targets; j++)
- info->export_targets[j] =
- ceph_decode_32(&pexport_targets);
+ for (j = 0; j < num_export_targets; j++) {
+ target = ceph_decode_32(&pexport_targets);
+ if (target >= m->possible_max_rank) {
+ err = -EIO;
+ goto corrupt;
+ }
+ info->export_targets[j] = target;
+ }
} else {
info->export_targets = NULL;
}