summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorXiubo Li <xiubli@redhat.com>2023-05-18 04:47:23 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-30 14:42:11 +0300
commit8a89c4f64d3dc657ca1e89c6325e556cb14f9770 (patch)
tree27cccb4e451799d86817382d39edeae774e0ae97 /fs
parente9bf0f2a9c2b1b06f09d34749f993a3b61a68fbe (diff)
downloadlinux-8a89c4f64d3dc657ca1e89c6325e556cb14f9770.tar.xz
ceph: force updating the msg pointer in non-split case
commit 4cafd0400bcb6187c0d4ab4d4b0229a89ac4f8c2 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/snap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index a5ef8275440d..07db34ffa7a1 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -976,6 +976,19 @@ skip_inode:
continue;
adjust_snap_realm_parent(mdsc, child, realm->ino);
}
+ } else {
+ /*
+ * In the non-split case both 'num_split_inos' and
+ * 'num_split_realms' should be 0, making this a no-op.
+ * However the MDS happens to populate 'split_realms' list
+ * in one of the UPDATE op cases by mistake.
+ *
+ * Skip both lists just in case to ensure that 'p' is
+ * positioned at the start of realm info, as expected by
+ * ceph_update_snap_trace().
+ */
+ p += sizeof(u64) * num_split_inos;
+ p += sizeof(u64) * num_split_realms;
}
/*