]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make PGLSFilter xattr read optional 5353/head
authorJohn Spray <john.spray@redhat.com>
Mon, 27 Jul 2015 10:05:56 +0000 (11:05 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 5 Aug 2015 13:33:49 +0000 (14:33 +0100)
The cephfs filter needs to be able to express
interest in an xattr, but not reject objects
which do not have it.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index aa399a3bd0f1052f011081a1cc27e43ba93f688e..3d0eb012966e406924a3885138c1ba30590825af 100644 (file)
@@ -549,8 +549,11 @@ bool ReplicatedPG::pgls_filter(PGLSFilter *filter, hobject_t& sobj, bufferlist&
       filter->get_xattr(),
       &bl);
     dout(0) << "getattr (sobj=" << sobj << ", attr=" << filter->get_xattr() << ") returned " << ret << dendl;
-    if (ret < 0)
-      return false;
+    if (ret < 0) {
+      if (ret != -ENODATA || filter->reject_empty_xattr()) {
+        return false;
+      }
+    }
   }
 
   return filter->filter(sobj, bl, outdata);
index b5e143455b5703d5d47df74d4c0865f004cb33de..70696b529fbdb8ecab7febc422ada22576852be7 100644 (file)
@@ -65,7 +65,18 @@ public:
   virtual ~PGLSFilter();
   virtual bool filter(const hobject_t &obj, bufferlist& xattr_data,
                       bufferlist& outdata) = 0;
-  virtual string& get_xattr() { return xattr; }
+
+  /**
+   * xattr key, or empty string.  If non-empty, this xattr will be fetched
+   * and the value passed into ::filter
+   */
+   virtual string& get_xattr() { return xattr; }
+
+  /**
+   * If true, objects without the named xattr (if xattr name is not empty)
+   * will be rejected without calling ::filter
+   */
+  virtual bool reject_empty_xattr() { return true; }
 };
 
 class PGLSPlainFilter : public PGLSFilter {