]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cls/rgw: rgw_dir_suggest_changes detects race with completion
authorCasey Bodley <cbodley@redhat.com>
Thu, 10 Mar 2022 20:32:48 +0000 (15:32 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 10 Mar 2022 22:04:01 +0000 (17:04 -0500)
commitaa381b6765b0fb316976c4af7a45f32a157a4f75
tree53847b3d20f2c656028577d80a9877c3dee6ab19
parent5bfc71e85dfc65f4873965a82ce98dc17e679416
cls/rgw: rgw_dir_suggest_changes detects race with completion

if bucket listing races with a pending index transaction, its suggested
removal may be mistakenly applied if that index transaction completes
before the osd receives this suggestion

in `rgw_dir_suggest_changes()`, the sole condition for applying a
suggested change is that the `cur_disk.pending_map` is empty. this is
true after rgw_bucket_complete_op()

on index completion, `rgw_bucket_dir_entry::index_ver` is updated to match
the new value of `rgw_bucket_dir_header::ver`. because most of `struct
rgw_bucket_dir_entry` makes the round trip through bucket listing ->
dir_suggest, we have access to the index_ver of the suggested entry. by
comparing this against the stored entry, we can ignore any suggestions
that were sent before the most recent completion

Fixes: https://tracker.ceph.com/issues/54528
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/cls/rgw/cls_rgw.cc