Skip to content

Commit 4f58bb7

Browse files
authored
Merge pull request ceph#56712 from kchheda3/wip-notif-reload-bkt
rgw/notify: fix crashes in lc due to reload of bucket. Reviewed-by: Casey Bodley <[email protected]>
2 parents bf89368 + fa5d370 commit 4f58bb7

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/rgw/driver/rados/rgw_cr_rados.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,15 @@ int send_sync_notification(const DoutPrefixProvider* dpp,
741741
return -EIO;
742742
}
743743
}
744+
// bucket attrs are required for notification and since its not loaded,
745+
// reload the bucket
746+
int r = bucket->load_bucket(dpp, null_yield);
747+
if (r < 0) {
748+
ldpp_dout(dpp, 1) << "ERROR: failed to load bucket attrs for bucket:"
749+
<< bucket->get_name() << " with error ret= " << r
750+
<< " . Not sending notification" << dendl;
751+
return r;
752+
}
744753
rgw::notify::reservation_t notify_res(dpp, store, obj, nullptr, bucket,
745754
user_id, bucket->get_tenant(), req_id,
746755
null_yield);

src/rgw/driver/rados/rgw_notify.cc

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
22
// vim: ts=8 sw=2 smarttab
33

44
#include "rgw_notify.h"
@@ -1011,21 +1011,7 @@ int publish_reserve(const DoutPrefixProvider* dpp,
10111011
rgw_pubsub_bucket_topics bucket_topics;
10121012
if (all_zonegroups_support(site, zone_features::notification_v2) &&
10131013
res.store->stat_topics_v1(res.user_tenant, res.yield, res.dpp) == -ENOENT) {
1014-
auto ret = 0;
1015-
if (!res.s) {
1016-
// for non S3-request caller (e.g., lifecycle, ObjectSync), bucket attrs
1017-
// are not loaded, so force to reload the bucket, that reloads the attr.
1018-
// for non S3-request caller, res.s is nullptr
1019-
ret = res.bucket->load_bucket(dpp, res.yield);
1020-
if (ret < 0) {
1021-
ldpp_dout(dpp, 1)
1022-
<< "ERROR: failed to reload bucket: '" << res.bucket->get_name()
1023-
<< "' to get bucket notification attrs with error ret= " << ret
1024-
<< dendl;
1025-
return ret;
1026-
}
1027-
}
1028-
ret = get_bucket_notifications(dpp, res.bucket, bucket_topics);
1014+
auto ret = get_bucket_notifications(dpp, res.bucket, bucket_topics);
10291015
if (ret < 0) {
10301016
return ret;
10311017
}

0 commit comments

Comments
 (0)