Skip to content

Commit 4cafd04

Browse files
lxbszidryomov
authored andcommitted
ceph: force updating the msg pointer in non-split case
When the MClientSnap reqeust's op is not CEPH_SNAP_OP_SPLIT the request may still contain a list of 'split_realms', and we need to skip it anyway. Or it will be parsed as a corrupt snaptrace. Cc: stable@vger.kernel.org Link: https://tracker.ceph.com/issues/61200 Reported-by: Frank Schilder <frans@dtu.dk> Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 9aaa7eb commit 4cafd04

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/ceph/snap.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,19 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
11111111
continue;
11121112
adjust_snap_realm_parent(mdsc, child, realm->ino);
11131113
}
1114+
} else {
1115+
/*
1116+
* In the non-split case both 'num_split_inos' and
1117+
* 'num_split_realms' should be 0, making this a no-op.
1118+
* However the MDS happens to populate 'split_realms' list
1119+
* in one of the UPDATE op cases by mistake.
1120+
*
1121+
* Skip both lists just in case to ensure that 'p' is
1122+
* positioned at the start of realm info, as expected by
1123+
* ceph_update_snap_trace().
1124+
*/
1125+
p += sizeof(u64) * num_split_inos;
1126+
p += sizeof(u64) * num_split_realms;
11141127
}
11151128

11161129
/*

0 commit comments

Comments
 (0)