hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/ceph/snap.c
....@@ -647,8 +647,10 @@
647647 capsnap->size);
648648
649649 spin_lock(&mdsc->snap_flush_lock);
650
- if (list_empty(&ci->i_snap_flush_item))
650
+ if (list_empty(&ci->i_snap_flush_item)) {
651
+ ihold(inode);
651652 list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list);
653
+ }
652654 spin_unlock(&mdsc->snap_flush_lock);
653655 return 1; /* caller may want to ceph_flush_snaps */
654656 }
....@@ -1008,6 +1010,19 @@
10081010 continue;
10091011 adjust_snap_realm_parent(mdsc, child, realm->ino);
10101012 }
1013
+ } else {
1014
+ /*
1015
+ * In the non-split case both 'num_split_inos' and
1016
+ * 'num_split_realms' should be 0, making this a no-op.
1017
+ * However the MDS happens to populate 'split_realms' list
1018
+ * in one of the UPDATE op cases by mistake.
1019
+ *
1020
+ * Skip both lists just in case to ensure that 'p' is
1021
+ * positioned at the start of realm info, as expected by
1022
+ * ceph_update_snap_trace().
1023
+ */
1024
+ p += sizeof(u64) * num_split_inos;
1025
+ p += sizeof(u64) * num_split_realms;
10111026 }
10121027
10131028 /*