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>
(cherry picked from commit
06507992e3fad837c4667f467d59fc026a2ca0e8)
Conflicts:
src/rgw/rgw_op.cc
reordering the check seqence and replace some op_ret to ret
Backport Change:
We remove the `tenant` parameter because this feature is not introduced on hammer version.
The rgw multi-tenant feature is introduced on pr#6784 (https://github.com/ceph/ceph/pull/6784)
This feature is supported from v10.0.2 and later version.
}
}
+ ret = rgw_bucket_sync_user_stats(store, 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);
}
}
+ ret = rgw_bucket_sync_user_stats(store, s->user.user_id, s->bucket);
+ if ( ret < 0) {
+ ldout(s->cct, 1) << "WARNING: failed to sync user stats before bucket delete: ret= " << ret << dendl;
+ }
+
ret = store->delete_bucket(s->bucket, ot);
if (ret == 0) {