]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: user quota may not adjust on bucket removal 8113/head
authorVicente Cheng <freeze.bilsted@gmail.com>
Tue, 9 Feb 2016 20:03:24 +0000 (12:03 -0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Wed, 6 Apr 2016 09:43:16 +0000 (17:43 +0800)
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.

src/rgw/rgw_bucket.cc
src/rgw/rgw_op.cc

index 5d2af38ea6fb1995cb68647913797402f2c5fca9..54883063af3aea02b3093a689bc5e5366b35f732 100644 (file)
@@ -433,6 +433,11 @@ int rgw_remove_bucket(RGWRados *store, const string& bucket_owner, rgw_bucket& b
     }
   }
 
+  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);
index cd8785f19dea8b8591d1e2b859cc9c63229f0fcd..4f32a584c8b75918a1af0ab823e1acac3c91cf8a 100644 (file)
@@ -1471,6 +1471,11 @@ void RGWDeleteBucket::execute()
     }
   }
 
+  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) {