From: Yehuda Sadeh Date: Tue, 25 Jun 2013 18:05:15 +0000 (-0700) Subject: rgw: filter read xattrs X-Git-Tag: v0.67-rc1~128^2~43 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8bd31d42a25ffb162ced98b3c1fa75cc09444036;p=ceph.git rgw: filter read xattrs We're only interested in object xattrs that have specific rgw.user prefix. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e8638a8173ab..a382f21467bb 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4419,7 +4419,7 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, io_ctx.locator_set_key(key); - map attrset; + map unfiltered_attrset; uint64_t size = 0; time_t mtime = 0; @@ -4427,7 +4427,7 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, if (objv_tracker) { objv_tracker->prepare_op_for_read(&op); } - op.getxattrs(&attrset, NULL); + op.getxattrs(&unfiltered_attrset, NULL); op.stat(&size, &mtime, NULL); if (first_chunk) { op.read(0, RGW_MAX_CHUNK_SIZE, first_chunk, NULL); @@ -4441,6 +4441,16 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, if (r < 0) return r; + map attrset; + map::iterator iter; + string check_prefix = RGW_ATTR_PREFIX; + for (iter = unfiltered_attrset.lower_bound(check_prefix); + iter != unfiltered_attrset.end(); ++iter) { + if (!str_startswith(iter->first, check_prefix)) + break; + attrset[iter->first] = iter->second; + } + if (psize) *psize = size; if (pmtime)