]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: filter ceph.* xattrs from listing
authorVenky Shankar <vshankar@redhat.com>
Fri, 28 Aug 2020 10:49:24 +0000 (06:49 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 13 Oct 2020 04:29:38 +0000 (00:29 -0400)
Since xattr_map has entries for xattrs in ceph namespace.
Such xattrs are accessible via getxattr().

Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/client/Client.cc

index 75cf13652d8dfbb5ee12c0217336e69afdd8244f..d43f072ac16ec7261866d8d25f1f4971454f0515 100644 (file)
@@ -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;
   }