mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
rgw: multipart abort if upload meta object doesn't exist
Signed-off-by: fang yuxiang fang.yuxiang@eisoo.com
This commit is contained in:
parent
1f32d63e6d
commit
e20987c8e3
@ -3129,9 +3129,8 @@ int RGWPutObjProcessor_Multipart::do_complete(size_t accounted_size,
|
||||
rgw_raw_obj raw_meta_obj;
|
||||
|
||||
store->obj_to_raw(s->bucket_info.placement_rule, meta_obj, &raw_meta_obj);
|
||||
|
||||
r = store->omap_set(raw_meta_obj, p, bl);
|
||||
|
||||
const bool must_exist = true;// detect races with abort
|
||||
r = store->omap_set(raw_meta_obj, p, bl, must_exist);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -12169,7 +12169,7 @@ int RGWRados::omap_get_all(rgw_raw_obj& obj, bufferlist& header,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RGWRados::omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl)
|
||||
int RGWRados::omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl, bool must_exist)
|
||||
{
|
||||
rgw_rados_ref ref;
|
||||
int r = get_raw_obj_ref(obj, &ref);
|
||||
@ -12180,13 +12180,15 @@ int RGWRados::omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl)
|
||||
|
||||
map<string, bufferlist> m;
|
||||
m[key] = bl;
|
||||
|
||||
r = ref.ioctx.omap_set(ref.oid, m);
|
||||
|
||||
ObjectWriteOperation op;
|
||||
if (must_exist)
|
||||
op.assert_exists();
|
||||
op.omap_set(m);
|
||||
r = ref.ioctx.operate(ref.oid, &op);
|
||||
return r;
|
||||
}
|
||||
|
||||
int RGWRados::omap_set(rgw_raw_obj& obj, std::map<std::string, bufferlist>& m)
|
||||
int RGWRados::omap_set(rgw_raw_obj& obj, std::map<std::string, bufferlist>& m, bool must_exist)
|
||||
{
|
||||
rgw_rados_ref ref;
|
||||
int r = get_raw_obj_ref(obj, &ref);
|
||||
@ -12194,8 +12196,11 @@ int RGWRados::omap_set(rgw_raw_obj& obj, std::map<std::string, bufferlist>& m)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = ref.ioctx.omap_set(ref.oid, m);
|
||||
|
||||
ObjectWriteOperation op;
|
||||
if (must_exist)
|
||||
op.assert_exists();
|
||||
op.omap_set(m);
|
||||
r = ref.ioctx.operate(ref.oid, &op);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -3364,8 +3364,8 @@ public:
|
||||
|
||||
int omap_get_vals(rgw_raw_obj& obj, bufferlist& header, const std::string& marker, uint64_t count, std::map<string, bufferlist>& m);
|
||||
int omap_get_all(rgw_raw_obj& obj, bufferlist& header, std::map<string, bufferlist>& m);
|
||||
int omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl);
|
||||
int omap_set(rgw_raw_obj& obj, map<std::string, bufferlist>& m);
|
||||
int omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl, bool must_exist = false);
|
||||
int omap_set(rgw_raw_obj& obj, map<std::string, bufferlist>& m, bool must_exist = false);
|
||||
int omap_del(rgw_raw_obj& obj, const std::string& key);
|
||||
int update_containers_stats(map<string, RGWBucketEnt>& m);
|
||||
int append_async(rgw_raw_obj& obj, size_t size, bufferlist& bl);
|
||||
|
Loading…
Reference in New Issue
Block a user