Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd-mirror: prevent I/O modifications against a non-primary image #33831

Merged
merged 14 commits into from
Mar 12, 2020

Conversation

dillaman
Copy link

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • 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 backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@dillaman dillaman added this to the octopus milestone Mar 10, 2020
@dillaman dillaman changed the title rbd-mirror: prevent IO/modifications against a non-primary image rbd-mirror: prevent I/O modifications against a non-primary image Mar 10, 2020
@trociny
Copy link
Contributor

trociny commented Mar 10, 2020

@dillaman unittest_rbd_mirror crashed on jenkins

@dillaman
Copy link
Author

jenkins test make check

@dillaman
Copy link
Author

(appended a commit that fixed a random failure in the unit tests due to notifications not getting delivered to rbd-mirror)

Jason Dillaman added 13 commits March 10, 2020 19:23
When a snapshot-based image is non-primary, we will need to use
this implicit feature to ensure that writes and maintenance
operations cannot be performed against the image.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This will be utilized by the RefreshRequest state machine to flag the image
as read-only if the new RBD_FEATURE_NON_PRIMARY feature is enabled. Also
allow that flag to be masked out by rbd-mirror daemon to permit IO and
operations against a non-primary image.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
With the non-primary feature bit is enabled, mask-out the read-only
feature bit that will be set in the refresh image state machine if
the image has that feature bit set. This will ensure that only the
rbd-mirror daemon will be able to modify a non-primary image.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
When promoted to primary, disable the non-primary feature bit and
when demoted (or created non-primary), enable the non-primary feature
bit. This will prevent all non rbd-mirror RBD clients from modifying
the RBD image.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The promote state machine will handle remove the non-primary
feature bit and will ensure an interrupted disable operation
doesn't leave things in an inconsistent state.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The exclusive-lock and journaling features are not required for
snapshot-based mirroring.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This variable is not currently used in snapshot-based mirroring
mode but it should be populated for consistency.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The state machine was incorrectly skipping over the mirror enable
step for non-primary images when the journaling feature bit was not
enabled.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
When using snapshot-based mirroring, there shouldn't be any need to
force the use of the exclusive-lock feature.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
…ures

Ensure that snapshot-based mirroring is tested in different RBD image
feature combinations.

Fixes: https://tracker.ceph.com/issues/44396
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This feature is mutable from only within librbd as a mirrored image
is promoted/demoted.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
If a refresh is in-progress when a header update notification is
received, the notification was previously incorrectly dropped.
This prevented rbd-mirror's snapshot-based mirroring replayer from
detecting updates in some cases.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The non-primary image might have mirror snapshots that need to be
updated to remove the peer reference.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The new RBD_FEATURE_NON_PRIMARY overlaps with the legacy test
for an invalid feature bit.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
@dillaman
Copy link
Author

http://pulpito.ceph.com/jdillaman-2020-03-11_14:09:34-rbd-wip-jd-testing-distro-basic-smithi/ (includes the fast-diff PR and the rbd_support pool scan improvements)

Copy link
Contributor

@trociny trociny left a comment

Choose a reason for hiding this comment

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

LGTM

@trociny trociny merged commit e8e0382 into ceph:octopus Mar 12, 2020
@dillaman dillaman deleted the wip-44396 branch March 12, 2020 11:42
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.

2 participants