mirror of
https://github.com/ceph/ceph
synced 2024-12-29 15:03:33 +00:00
Merge pull request #24846 from taoCH/wip-fix-librgw-quota-check
rgw_file: not check max_objects when creating file Reviewed-by: Matt Benjamin <mbenjami@redhat.com>
This commit is contained in:
commit
dde9ce1824
@ -661,6 +661,10 @@ namespace rgw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get<1>(mkr) = rc;
|
get<1>(mkr) = rc;
|
||||||
|
|
||||||
|
/* case like : quota exceed will be considered as fail too*/
|
||||||
|
if(rc2 < 0)
|
||||||
|
get<1>(mkr) = rc2;
|
||||||
|
|
||||||
return mkr;
|
return mkr;
|
||||||
} /* RGWLibFS::create */
|
} /* RGWLibFS::create */
|
||||||
@ -1368,6 +1372,12 @@ namespace rgw {
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
op_ret = get_store()->check_quota(s->bucket_owner.get_id(), s->bucket,
|
||||||
|
user_quota, bucket_quota, real_ofs, true);
|
||||||
|
/* max_size exceed */
|
||||||
|
if (op_ret < 0)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
size_t len = data.length();
|
size_t len = data.length();
|
||||||
if (! len)
|
if (! len)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1406,7 +1416,8 @@ namespace rgw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op_ret = get_store()->check_quota(s->bucket_owner.get_id(), s->bucket,
|
op_ret = get_store()->check_quota(s->bucket_owner.get_id(), s->bucket,
|
||||||
user_quota, bucket_quota, s->obj_size);
|
user_quota, bucket_quota, s->obj_size, true);
|
||||||
|
/* max_size exceed */
|
||||||
if (op_ret < 0) {
|
if (op_ret < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -9750,8 +9750,12 @@ int RGWRados::add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
int RGWRados::check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
|
int RGWRados::check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
|
||||||
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size)
|
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only)
|
||||||
{
|
{
|
||||||
|
// if we only check size, then num_objs will set to 0
|
||||||
|
if(check_size_only)
|
||||||
|
return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 0, obj_size);
|
||||||
|
|
||||||
return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 1, obj_size);
|
return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 1, obj_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2320,7 +2320,7 @@ public:
|
|||||||
int cls_user_get_bucket_stats(const rgw_bucket& bucket, cls_user_bucket_entry& entry);
|
int cls_user_get_bucket_stats(const rgw_bucket& bucket, cls_user_bucket_entry& entry);
|
||||||
|
|
||||||
int check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
|
int check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
|
||||||
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size);
|
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only = false);
|
||||||
|
|
||||||
int check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket,
|
int check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket,
|
||||||
RGWQuotaInfo& bucket_quota);
|
RGWQuotaInfo& bucket_quota);
|
||||||
|
Loading…
Reference in New Issue
Block a user