Skip to content

reef: librbd: avoid data corruption on flatten when object map is inconsistent#61167

Merged
sunilangadi2 merged 2 commits intoceph:reeffrom
idryomov:wip-68998-reef
Jan 17, 2025
Merged

reef: librbd: avoid data corruption on flatten when object map is inconsistent#61167
sunilangadi2 merged 2 commits intoceph:reeffrom
idryomov:wip-68998-reef

Conversation

@idryomov
Copy link
Contributor

By making flatten skip copyup in case the object is marked
OBJECT_EXISTS or OBJECT_EXISTS_CLEAN, commit 40af4f8 ("librbd:
flatten operation should use object map") introduced a critical
regression.  If the object map becomes inconsistent (e.g. because
flatten gets interrupted by killing "rbd flatten" process or a client
running on the clone crashes after updating the object map but before
writing to the image), the following attempt to flatten would corrupt
the clone if the copyup is actually still needed.

By design, it's impossible to tell whether the object is "known to
exist" based on the object map -- only telling whether the object is
"known to NOT exist" is possible (i.e. only OBJECT_NONEXISTENT state
is reliable).  Negating OBJECT_NONEXISTENT tells that the object "may
exist", not that the object is "known to exist".  This is reflected in
the name of object_may_exist() helper that was introduced together with
the object map implementation.  Something like object_may_not_exist()
simply can't be constructed given the rest of librbd.

This effectively reverts commits 4c86bcc ("librbd: add
object_may_not_exist helper") and 40af4f8 ("librbd: flatten
operation should use object map").

Fixes: https://tracker.ceph.com/issues/68998
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 97ed3fc)
Inject an object map with all possible inconsistencies before
flattening to ensure that something similar to commit 40af4f8
("librbd: flatten operation should use object map") doesn't reappear
in a different form.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit ffcd903)
@idryomov idryomov added this to the v18.2.5 milestone Dec 22, 2024
@idryomov idryomov requested a review from a team as a code owner December 22, 2024 15:32
@sunilangadi2
Copy link

jenkins test make check

2 similar comments
@yuriw
Copy link
Contributor

yuriw commented Jan 7, 2025

jenkins test make check

@yuriw
Copy link
Contributor

yuriw commented Jan 8, 2025

jenkins test make check

@yuriw
Copy link
Contributor

yuriw commented Jan 10, 2025

This is ready for merge as soon as make check passed
ref: https://tracker.ceph.com/issues/69414

@yuriw
Copy link
Contributor

yuriw commented Jan 13, 2025

jenkins test make check

1 similar comment
@yuriw
Copy link
Contributor

yuriw commented Jan 16, 2025

jenkins test make check

@sunilangadi2 sunilangadi2 merged commit a529f61 into ceph:reef Jan 17, 2025
@idryomov idryomov deleted the wip-68998-reef branch January 17, 2025 10:24
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.

4 participants