rgw: fix rgw hang when do RGWRealmReloader::reload after go SIGHUP

Quota async processer reference count err when bucket has no explicit shard

Fixes: http://tracker.ceph.com/issues/20686

Signed-off-by: fang yuxiang fang.yuxiang@eisoo.com
This commit is contained in:
fang.yuxiang 2017-07-19 18:49:11 +08:00
parent ff05c2eea7
commit 957b9bdee2
2 changed files with 15 additions and 4 deletions

View File

@ -85,6 +85,7 @@ public:
void set_stats(const rgw_user& user, const rgw_bucket& bucket, RGWQuotaCacheStats& qs, RGWStorageStats& stats);
int async_refresh(const rgw_user& user, const rgw_bucket& bucket, RGWQuotaCacheStats& qs);
void async_refresh_response(const rgw_user& user, rgw_bucket& bucket, RGWStorageStats& stats);
void async_refresh_fail(const rgw_user& user, rgw_bucket& bucket);
class AsyncRefreshHandler {
protected:
@ -157,6 +158,14 @@ int RGWQuotaCache<T>::async_refresh(const rgw_user& user, const rgw_bucket& buck
return 0;
}
template<class T>
void RGWQuotaCache<T>::async_refresh_fail(const rgw_user& user, rgw_bucket& bucket)
{
ldout(store->ctx(), 20) << "async stats refresh response for bucket=" << bucket << dendl;
async_refcount->put();
}
template<class T>
void RGWQuotaCache<T>::async_refresh_response(const rgw_user& user, rgw_bucket& bucket, RGWStorageStats& stats)
{
@ -294,7 +303,8 @@ void BucketAsyncRefreshHandler::handle_response(const int r)
{
if (r < 0) {
ldout(store->ctx(), 20) << "AsyncRefreshHandler::handle_response() r=" << r << dendl;
return; /* nothing to do here */
cache->async_refresh_fail(user, bucket);
return;
}
RGWStorageStats bs;
@ -405,7 +415,8 @@ void UserAsyncRefreshHandler::handle_response(int r)
{
if (r < 0) {
ldout(store->ctx(), 20) << "AsyncRefreshHandler::handle_response() r=" << r << dendl;
return; /* nothing to do here */
cache->async_refresh_fail(user, bucket);
return;
}
cache->async_refresh_response(user, bucket, stats);

View File

@ -11588,16 +11588,16 @@ public:
int RGWRados::get_bucket_stats_async(RGWBucketInfo& bucket_info, int shard_id, RGWGetBucketStats_CB *ctx)
{
int num_aio = 0;
RGWGetBucketStatsContext *get_ctx = new RGWGetBucketStatsContext(ctx, bucket_info.num_shards);
RGWGetBucketStatsContext *get_ctx = new RGWGetBucketStatsContext(ctx, bucket_info.num_shards ? : 1);
assert(get_ctx);
int r = cls_bucket_head_async(bucket_info, shard_id, get_ctx, &num_aio);
get_ctx->put();
if (r < 0) {
ctx->put();
if (num_aio) {
get_ctx->unset_cb();
}
}
get_ctx->put();
return r;
}