]> 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)
committerJ. Eric Ivancich <ivancich@redhat.com>
Wed, 13 Apr 2022 17:50:31 +0000 (13:50 -0400)
commit3b54aff8e2e3ccd6c01bad2150eae6531af050c6
tree22ac51f9f1aeeb1292462f832dfb0f0f88bc9742
parentb51d866559c7cde15d3b75ee17bbba8fdf2584be
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>
(cherry picked from commit aa381b6765b0fb316976c4af7a45f32a157a4f75)
src/cls/rgw/cls_rgw.cc