Skip to content

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

Merged
idryomov merged 4 commits into
ceph:mainfrom
idryomov:wip-66300
Jun 19, 2024
Merged

idryomov merged 4 commits into
ceph:mainfrom
idryomov:wip-66300

Conversation

@idryomov

Copy link
Copy Markdown
Contributor

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@idryomov
idryomov requested a review from a team as a code owner June 16, 2024 16:44
idryomov added 4 commits June 17, 2024 00:16
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]>
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]>
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]>
@idryomov

Copy link
Copy Markdown
Contributor Author

jenkins test make check

Comment thread src/librbd/api/Group.cc
}
}

if (rollback_images != current_images) {

@nbalacha nbalacha Jun 18, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would effectively mean that any older snaps taken before a membership change could not be used for a rollback. Wouldn't that defeat the purpose of having the snap?

@idryomov idryomov Jun 18, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the image(s) in question are around, the user can trivially restore membership before issuing rollback.

Putting the potential data loss aside, conceptually, we want post-rollback group to look exactly the same as it looked when the rollback snapshot was taken. If the group is going to be missing some images, denying the rollback request seems prudent.

@ajarr

ajarr commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

Reviewed the commits. I couldn't make full sense of 91a0632 . Maybe we want to core to approve it? The code in the other 3 commits look good.

I've a question regarding disallowing group snap rollback due to mismatch in group membership.
Why deny rolling back to a group snapshot whose image membership is a subset of current group's image membership?

@ajarr ajarr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've a question regarding disallowing group snap rollback due to mismatch in group membership. Why deny rolling back to a group snapshot whose image membership is a subset of current group's image membership?

For images that are not part of the group snapshot being roll-backed to,
can we roll them back to their first .group snapshot ID, since the first .group snapshot was created when the image was added to the group?

@idryomov

Copy link
Copy Markdown
Contributor Author

I couldn't make full sense of 91a0632 . Maybe we want to core to approve it? The code in the other 3 commits look good.

librados_test_stub is used exclusively by RBD, so we don't.

@idryomov

idryomov commented Jun 18, 2024 •

Copy link
Copy Markdown
Contributor Author

Why deny rolling back to a group snapshot whose image membership is a subset of current group's image membership?

Because post-rollback the group would be a mixed bag: that subset of images would be "as of rollback snapshot", while the rest would stay "in the future". I don't know how one can be expected to make sense of that, especially over time.

With this change, the user would need to remove any extra images from the group before rollback. As a consequence, post-rollback group would look exactly the same as it looked when the rollback snapshot was taken.

@idryomov

idryomov commented Jun 18, 2024 •

Copy link
Copy Markdown
Contributor Author

For images that are not part of the group snapshot being roll-backed to, can we roll them back to their first .group snapshot ID

I strongly believe that such images shouldn't be touched at all -- that is really the point of this change.

since the first .group snapshot was created when the image was added to the group?

No .group snapshots are created when an image is added to the group -- you are probably confusing this with the on-going work on mirroring. And if they were created, doing this would still make the group a mixed bag since those snapshots would be in the future relative to the rollback snapshot.

@ajarr

ajarr commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

For images that are not part of the group snapshot being roll-backed to, can we roll them back to their first .group snapshot ID

I strongly believe that such images shouldn't be touched at all -- that is really the point of this change.

Makes sense

since the first .group snapshot was created when the image was added to the group?

No .group snapshots are created when an image is added to the group -- you are probably confusing this with the on-going work on mirroring. And if they were created, doing this would still make the group a mixed bag since those snapshots would be in the future relative to the rollback snapshot.

I mixed this up with mirroring work here.

@ajarr ajarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
As mentioned before, I didn't completely follow what's happening in TestMemIoCtxImpl::selfmanaged_snap_rollback()

@idryomov

idryomov commented Jun 27, 2024 •

Copy link
Copy Markdown
Contributor Author

With exclusive lock disabled and RBD cache either in writethrough or writeback mode, e.g.

rbd/librbd/{cache/writeback clusters/{fixed-3 openstack} conf/{disable-pool-app} data-pool/ec extra-conf/none min-compat-client/default msgr-failures/few objectstore/bluestore-bitmap supported-random-distro$/{centos_latest} workloads/c_api_tests}

this fails as follows:

2024-06-26T10:30:16.613 INFO:tasks.workunit.client.0.smithi160.stdout:[ RUN      ] TestGroup.add_snapshot
2024-06-26T10:30:17.478 INFO:tasks.workunit.client.0.smithi160.stdout:/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-4557-g0fa2a0e1/rpm/el9/BUILD/ceph-19.0.0-4557-g0fa2a0e1/src/test/librbd/test_Groups.cc:356: Failure
2024-06-26T10:30:17.478 INFO:tasks.workunit.client.0.smithi160.stdout:Expected equality of these values:
2024-06-26T10:30:17.478 INFO:tasks.workunit.client.0.smithi160.stdout:  0
2024-06-26T10:30:17.478 INFO:tasks.workunit.client.0.smithi160.stdout:  memcmp(orig_data, read_data, 10)
2024-06-26T10:30:17.479 INFO:tasks.workunit.client.0.smithi160.stdout:    Which is: -116
2024-06-26T10:30:17.480 INFO:tasks.workunit.client.0.smithi160.stdout:[  FAILED  ] TestGroup.add_snapshot (866 ms)
2024-06-26T10:30:17.480 INFO:tasks.workunit.client.0.smithi160.stdout:[ RUN      ] TestGroup.add_snapshotPP
2024-06-26T10:30:17.491 INFO:tasks.workunit.client.0.smithi160.stdout:/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-4557-g0fa2a0e1/rpm/el9/BUILD/ceph-19.0.0-4557-g0fa2a0e1/src/test/librbd/test_Groups.cc:415: Failure
2024-06-26T10:30:17.491 INFO:tasks.workunit.client.0.smithi160.stdout:Expected equality of these values:
2024-06-26T10:30:17.491 INFO:tasks.workunit.client.0.smithi160.stdout:  0
2024-06-26T10:30:17.492 INFO:tasks.workunit.client.0.smithi160.stdout:  rbd.group_create(ioctx, group_name)
2024-06-26T10:30:17.492 INFO:tasks.workunit.client.0.smithi160.stdout:    Which is: -17
2024-06-26T10:30:17.492 INFO:tasks.workunit.client.0.smithi160.stdout:[  FAILED  ] TestGroup.add_snapshotPP (12 ms)

add_snapshotPP would have failed with a similar error on ASSERT_TRUE(expect_bl.contents_equal(read_bl)) if it wasn't masked by add_snapshot and add_snapshotPP using the same group name. All of this is addressed in #58300.

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