]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: fix silly abuse of flags in fh_lookup
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 13 Apr 2016 14:07:05 +0000 (10:07 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 13 Apr 2016 14:14:41 +0000 (10:14 -0400)
Initially lookup_fh used its cflags argument just to proxy create
flags to new objects.  It's used for call path state now too, so
disambiguate it, and of course, fh->flags can't be consulted for
a call path state.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.h

index 0cf1d679f5b432bdf7200c43b409c8c15a850319..d1c627c1fd66f89b98b81928c9e735f0fd069787 100644 (file)
@@ -216,6 +216,9 @@ namespace rgw {
     static constexpr uint32_t FLAG_LOCK =   0x0040;
     static constexpr uint32_t FLAG_DELETED = 0x0080;
 
+#define CREATE_FLAGS(x) \
+    ((x) & ~(RGWFileHandle::FLAG_CREATE|RGWFileHandle::FLAG_LOCK))
+
     friend class RGWLibFS;
 
   private:
@@ -784,7 +787,7 @@ namespace rgw {
 
     /* find or create an RGWFileHandle */
     LookupFHResult lookup_fh(RGWFileHandle* parent, const char *name,
-                            const uint32_t cflags = RGWFileHandle::FLAG_NONE) {
+                            const uint32_t flags = RGWFileHandle::FLAG_NONE) {
       using std::get;
 
       LookupFHResult fhr { nullptr, RGWFileHandle::FLAG_NONE };
@@ -822,19 +825,19 @@ namespace rgw {
          goto retry; /* !LATCHED */
        }
        /* LATCHED, LOCKED */
-       if (! (fh->flags & RGWFileHandle::FLAG_LOCK))
+       if (! (flags & RGWFileHandle::FLAG_LOCK))
          fh->mtx.unlock(); /* ! LOCKED */
       } else {
        /* make or re-use handle */
        RGWFileHandle::Factory prototype(this, get_inst(), parent, fhk,
-                                        obj_name, cflags);
+                                        obj_name, CREATE_FLAGS(flags));
        fh = static_cast<RGWFileHandle*>(
          fh_lru.insert(&prototype,
                        cohort::lru::Edge::MRU,
                        cohort::lru::FLAG_INITIAL));
        if (fh) {
          /* lock fh (LATCHED) */
-         if (fh->flags & RGWFileHandle::FLAG_LOCK)
+         if (flags & RGWFileHandle::FLAG_LOCK)
            fh->mtx.lock();
          /* inserts, releasing latch */
          fh_cache.insert_latched(fh, lat, RGWFileHandle::FHCache::FLAG_UNLOCK);