]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: permit lookup_handle to lookup root_fh
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 6 Jun 2019 20:54:43 +0000 (16:54 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 25 Jul 2019 10:19:29 +0000 (12:19 +0200)
Originally, root_fh was reachable from RGWLibFS::fh_cache, but
this was problematic as it has infinite lifetime and so is not
present in RGWLibFS::fs_lru.

To fix the above, RGWLibFS::root_fh came to live unhooked from the
handle caches which works because nfs-ganesha/the application
always has an instance handle.  However, this silently breaks
READDIR event invalidation.

Fixes: https://tracker.ceph.com/issues/40196
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 547cb9f87b72440cb8a1d496ac5cfb37b2d83cc7)

src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 5c0a4d3beffbd40fb8d6defb4d363575695c94f1..301322223dbc403b8ebe6d6a9b16ba14dd4bdb98 100644 (file)
@@ -993,7 +993,12 @@ namespace rgw {
        << dendl;
       {
        lock_guard guard(state.mtx); /* LOCKED */
-       /* just return if no events */
+       lsubdout(get_context(), rgw, 15)
+         << "GC: processing"
+         << " count=" << events.size()
+         << " events"
+         << dendl;
+        /* just return if no events */
        if (events.empty()) {
          return;
        }
@@ -1189,6 +1194,11 @@ namespace rgw {
     struct timespec now;
     CephContext* cct = fs->get_context();
 
+    lsubdout(cct, rgw, 10)
+      << __func__ << " readdir called on "
+      << object_name()
+      << dendl;
+
     directory* d = get<directory>(&variant_type);
     if (d) {
       (void) clock_gettime(CLOCK_MONOTONIC_COARSE, &now); /* !LOCKED */
@@ -1215,9 +1225,6 @@ namespace rgw {
          set_nlink(2);
        inc_nlink(req.d_count);
        *eof = req.eof();
-       event ev(event::type::READDIR, get_key(), state.atime);
-       lock_guard sguard(fs->state.mtx);
-       fs->state.push_event(ev);
       }
     } else {
       RGWReaddirRequest req(cct, fs->get_user(), this, rcb, cb_arg, offset);
@@ -1230,12 +1237,13 @@ namespace rgw {
          set_nlink(2);
        inc_nlink(req.d_count);
        *eof = req.eof();
-       event ev(event::type::READDIR, get_key(), state.atime);
-       lock_guard sguard(fs->state.mtx);
-       fs->state.push_event(ev);
       }
     }
 
+    event ev(event::type::READDIR, get_key(), state.atime);
+    lock_guard sguard(fs->state.mtx);
+    fs->state.push_event(ev);
+
     lsubdout(fs->get_context(), rgw, 15)
       << __func__
       << " final link count=" << state.nlink
index 1bd9433240370b2c518178c1474aeed0cf83f96d..e45aa58cb61ad1f00e0c8be67a44cb32fb7f0583 100644 (file)
@@ -1205,10 +1205,13 @@ namespace rgw {
                            RGWFileHandle::FHCache::FLAG_LOCK);
       /* LATCHED */
       if (! fh) {
+       if (unlikely(fhk == root_fh.fh.fh_hk)) {
+         /* lookup for root of this fs */
+         fh = &root_fh;
+         goto out;
+       }
        lsubdout(get_context(), rgw, 0)
-         << __func__ << " handle lookup failed <"
-         << fhk.fh_hk.bucket << "," << fhk.fh_hk.object << ">"
-         << "(need persistent handles)"
+         << __func__ << " handle lookup failed " << fhk
          << dendl;
        goto out;
       }