From: Venky Shankar Date: Fri, 28 Aug 2020 10:49:24 +0000 (-0400) Subject: client: filter ceph.* xattrs from listing X-Git-Tag: v16.1.0~827^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7341863a7dc4b89eda0da917813f230fc95ffad7;p=ceph.git client: filter ceph.* xattrs from listing Since xattr_map has entries for xattrs in ceph namespace. Such xattrs are accessible via getxattr(). Signed-off-by: Venky Shankar --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 75cf13652d8d..d43f072ac16e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11821,8 +11821,12 @@ int Client::_listxattr(Inode *in, char *name, size_t size, } r = 0; - for (const auto& p : in->xattrs) { - size_t this_len = p.first.length() + 1; + for ([[maybe_unused]] const auto &[xattr_name, xattr_value_bl] : in->xattrs) { + if (xattr_name.rfind("ceph.", 0) == 0) { + continue; + } + + size_t this_len = xattr_name.length() + 1; r += this_len; if (len_only) continue; @@ -11832,7 +11836,7 @@ int Client::_listxattr(Inode *in, char *name, size_t size, goto out; } - memcpy(name, p.first.c_str(), this_len); + memcpy(name, xattr_name.c_str(), this_len); name += this_len; size -= this_len; }