]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: radosgw-admin abort early for user stats for empty uids
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 12 Mar 2018 13:14:22 +0000 (14:14 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 12 Apr 2018 18:01:41 +0000 (20:01 +0200)
Otherwise we'll call sync stats with an empty argument which results in creation
of an empty ".buckets" object

Fixes: http://tracker.ceph.com/issues/23322
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit aa3a408d4a66296cbf273551920f8ac9b381b2dd)
(cherry picked from commit 99dec6115bb6d8ef1cdaf658fc359a301d31017d)

src/rgw/rgw_admin.cc

index d05ebe239c7f95a14c0b39d4d5fca23b034db3b0..83427fe09f4a4fe62cbd27ceaebf6dd16cc35924 100644 (file)
@@ -6056,6 +6056,11 @@ next:
   }
 
   if (opt_cmd == OPT_USER_STATS) {
+    if (user_id.empty()) {
+      cerr << "ERROR: uid not specified" << std::endl;
+      return EINVAL;
+    }
+
     if (sync_stats) {
       if (!bucket_name.empty()) {
         int ret = rgw_bucket_sync_user_stats(store, tenant, bucket_name);
@@ -6072,10 +6077,6 @@ next:
       }
     }
 
-    if (user_id.empty()) {
-      cerr << "ERROR: uid not specified" << std::endl;
-      return EINVAL;
-    }
     cls_user_header header;
     string user_str = user_id.to_str();
     int ret = store->cls_user_get_header(user_str, &header);