librbd: Fix local rbd mirror journals growing forever
This commit fixes commit
7ca1bab90f3 by pushing properly aligned
discards back to m_image_extents, if corrected.
If discards are misaligned (off 0, len 4608, gran=4096), they are
corrected properly, but only in object_extents and not in
m_image_extents.
When journal_append_event is triggered it will only append from
m_image_extents and does not now about the alignment fixes. In
commit_io_events_extent it will log a message and return without
completing the io since the larger misaligned area was sent to the journal.
This will in turn break rbd journal mirroring since the local client will wait
indefinately on the commit to be completed, which it never does.
This does not effect rbd-mirror in any way, which may be confusing and
dangerous since it's only rbd-mirror that updates ceph health, and not
the local client.
Setting `rbd_skip_partial_discard = false` under client will restore the
pre
7ca1bab behaviour and thus not trigger the bug with journals growing.
This will set `rbd_discard_granularity_bytes = 0` internally. This
setting is only changed during startup of a client.
Fixes: 7ca1bab90f3db3aaaa4cdbfc1f18e9f5cfbf5568
Fixes: https://tracker.ceph.com/issues/57396
Signed-off-by: Josef Johansson <josef@oderland.se>
(cherry picked from commit
21a26a752843295ff946d1543c2f5f9fac764593)
Conflicts:
src/librbd/io/ImageRequest.cc [ commit
b2c88820923e ("librbd:
return area from extents_to_file()") not in quincy ]
src/test/librbd/io/test_mock_ImageRequest.cc [ commit
b9a2384cdc43 ("librbd: propagate area down to
file_to_extents()") not in quincy ]