]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #14231 from linuxbox2/wip-jewel-fhcache
authorKen Dreyer <kdreyer@redhat.com>
Fri, 31 Mar 2017 16:16:48 +0000 (10:16 -0600)
committerKen Dreyer <kdreyer@redhat.com>
Fri, 31 Mar 2017 16:16:51 +0000 (10:16 -0600)
jewel: rgw_fh: RGWFileHandle dtor must also cond-unlink from FHCache

Reviewed-by: Casey Bodley <cbodley@redhat.com>
1  2 
src/rgw/rgw_file.cc

index 1fe905039959ce55b76e6fe5463921c6ade2629d,afcace8464d7c9f9d1a9fe4d431198cb834cf875..53f7e0cddd541eac7cea45f427f3f5b4e5d53de9
@@@ -756,32 -719,12 +756,37 @@@ namespace rgw 
      } while (! (stop || shutdown));
    } /* RGWLibFS::gc */
  
 +  std::ostream& operator<<(std::ostream &os,
 +                         RGWFileHandle const &rgw_fh)
 +  {
 +    const auto& fhk = rgw_fh.get_key();
 +    const auto& fh = const_cast<RGWFileHandle&>(rgw_fh).get_fh();
 +    os << "<RGWFileHandle:";
 +    os << "addr=" << &rgw_fh << ";";
 +    switch (fh->fh_type) {
 +    case RGW_FS_TYPE_DIRECTORY:
 +      os << "type=DIRECTORY;";
 +      break;
 +    case RGW_FS_TYPE_FILE:
 +      os << "type=FILE;";
 +      break;
 +    default:
 +      os << "type=UNKNOWN;";
 +      break;
 +      };
 +    os << "fid=" << fhk.fh_hk.bucket << ":" << fhk.fh_hk.object << ";";
 +    os << "name=" << rgw_fh.object_name() << ";";
 +    os << "refcnt=" << rgw_fh.get_refcnt() << ";";
 +    os << ">";
 +    return os;
 +  }
 +
    RGWFileHandle::~RGWFileHandle() {
+     /* in the non-delete case, handle may still be in handle table */
+     if (fh_hook.is_linked()) {
+       fs->fh_cache.remove(fh.fh_hk.object, this, FHCache::FLAG_LOCK);
+     }
+     /* cond-unref parent */
      if (parent && (! parent->is_root())) {
        /* safe because if parent->unref causes its deletion,
         * there are a) by refcnt, no other objects/paths pointing