Skip to content

quincy: librbd: disallow group snap rollback if memberships don't match - #58208

Merged
yuriw merged 7 commits into
ceph:quincyfrom
idryomov:wip-66300-quincy
Aug 1, 2024
Merged

yuriw merged 7 commits into
ceph:quincyfrom
idryomov:wip-66300-quincy

Conversation

@idryomov

@idryomov idryomov commented Jun 23, 2024 •

Copy link
Copy Markdown
Contributor

@idryomov idryomov added this to the v17.2.8 milestone Jun 23, 2024
@idryomov
idryomov requested a review from a team as a code owner June 23, 2024 10:30
@idryomov

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@idryomov

Copy link
Copy Markdown
Contributor Author

Appended backport of #58300.

@idryomov

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@idryomov
idryomov force-pushed the wip-66300-quincy branch from a44b3ec to df42842 Compare July 8, 2024 14:23
@idryomov

idryomov commented Jul 8, 2024

Copy link
Copy Markdown
Contributor Author

Pushed a fixup for

        with Image(ioctx, self.image_names[0]) as image:
            image_snaps = list(image.list_snaps())
>           assert [s['namespace'] for s in image_snaps] == [RBD_SNAP_NAMESPACE_TYPE_GROUP,
                                                             RBD_SNAP_NAMESPACE_TYPE_GROUP,
                                                             RBD_SNAP_NAMESPACE_TYPE_GROUP]
E           NameError: name 'RBD_SNAP_NAMESPACE_TYPE_GROUP' is not defined

../../../clone.client.0/src/test/pybind/test_rbd.py:2919: NameError

failures. It slipped because #57954 is being backported only to squid.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

idryomov added 7 commits July 12, 2024 23:14
The rollback assert doesn't really test anything -- because orig_data
and test_data are written to non-overlapping areas, the test would pass
even if rbd_group_snap_rollback() does nothing (i.e. rollback isn't
performed) as long as the call returns 0.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit b3977c5)
After the rollback assert in TestGroup.add_snapshot{,PP} was made
meaningful in the previous commit, it fails in mock tests which means
that rollback has never been exercised properly...

While I confess to not following file->snap_id == CEPH_NOSNAP branch
especially given how file variable is shadowed, it's pretty clear that
get_snap_read() doesn't belong here -- the snapshot selected for reads
has nothing to do with rollback.  Replacing it with the rollback snap
ID makes sense of the other branches and makes the tests in question
pass.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit 91a0632)
Before proceeding with group rollback, ensure that the set of images
that took part in the group snapshot matches the set of images that are
currently part of the group.  Otherwise, because we preserve affected
snapshots when an image is removed from the group, data loss can ensue
where an image gets rolled back while part of another group or not part
of any group but long repurposed for something else.

Similarly, ensure that the group snapshot is complete.

Fixes: https://tracker.ceph.com/issues/66300
Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit f212a9c)

Conflicts:
	src/cls/rbd/cls_rbd_types.h [ provide operator== for
	  GroupImageSpec manually since quincy is on C++17 ]
	src/test/pybind/test_rbd.py [ commit d7fd66e ("librbd: add
	  rbd_clone4() API to take parent snapshot by ID") not in
	  quincy ]
Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit afbb744)
Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit db52fca)
Otherwise, a failing add_snapshot test causes add_snapshotPP test to
fail too, for example.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit 4c69370)
After rollback started being tested in commit b3977c5
("test/librbd: make rollback in TestGroup.add_snapshot{,PP}
meaningful"), these tests can fail on comparing post-rollback
data to expected data if run with exclusive lock disabled.
This doesn't occur with exclusive lock enabled because the RBD
cache gets invalidated implicitly before releasing the lock.

While at it, pass LIBRADOS_OP_FLAG_FADVISE_FUA to avoid relying
on any cache settings that happen to be in effect.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit a7e314c)
@idryomov

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@yuriw
yuriw merged commit 0546e8f into ceph:quincy Aug 1, 2024
@idryomov
idryomov deleted the wip-66300-quincy branch August 1, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants