rgw: user quota may not adjust on bucket removal

Description:
If the user/admin removes a bucket using --force/--purge-objects options with s3cmd/radosgw-admin respectively, the user stats will continue to reflect the deleted objects for quota purposes, and there seems to be no way to reset them. User stats need to be sync'ed prior to bucket removal.

Solution:
Sync user stats before removing a bucket.

Fixes: #14507
Signed-off-by: Edward Yang eyang@us.fujitsu.com
This commit is contained in:
root 2016-02-09 12:03:24 -08:00
parent 2c79a5e428
commit 06507992e3
2 changed files with 10 additions and 0 deletions

View File

@ -499,6 +499,11 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
}
}
ret = rgw_bucket_sync_user_stats(store, bucket.tenant, bucket.name);
if ( ret < 0) {
dout(1) << "WARNING: failed sync user stats before bucket delete. ret=" << ret << dendl;
}
RGWObjVersionTracker objv_tracker;
ret = store->delete_bucket(bucket, objv_tracker);

View File

@ -1878,6 +1878,11 @@ void RGWDeleteBucket::execute()
}
}
op_ret = rgw_bucket_sync_user_stats(store, s->user.user_id, s->bucket);
if ( op_ret < 0) {
ldout(s->cct, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
}
op_ret = store->delete_bucket(s->bucket, ot);
if (op_ret == 0) {
op_ret = rgw_unlink_bucket(store, s->user.user_id, s->bucket.tenant,