]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: Improve xattr import handling so future internal xattrs ignored
authorDavid Zafman <dzafman@redhat.com>
Tue, 13 Oct 2015 22:33:26 +0000 (15:33 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 30 Oct 2015 20:01:50 +0000 (13:01 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/rados/RadosImport.cc

index 1f74af2c86cdcce48437595f1c6a0be2594b1cf3..b4b397b1d9c405536e3a05a900a9d1c944f37697 100644 (file)
@@ -317,7 +317,9 @@ int RadosImport::get_object_rados(librados::IoCtx &ioctx, bufferlist &bl, bool n
         break;
       for (std::map<string,bufferlist>::iterator i = as.data.begin();
           i != as.data.end(); ++i) {
-        if (i->first == "_" || i->first == "snapset")
+       // The user xattrs that we want all begin with "_" with length > 1.
+        // Drop key "_" and all attributes that do not start with '_'
+        if (i->first == "_" || i->first[0] != '_')
           continue;
         ret = ioctx.setxattr(ob.hoid.hobj.oid.name, i->first.substr(1).c_str(), i->second);
         if (ret) {