]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: permit lookup_handle to lookup root_fh 28440/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 6 Jun 2019 20:54:43 +0000 (16:54 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 6 Jun 2019 21:03:00 +0000 (17:03 -0400)
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>
src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 74982308a64bad2177e00e6272063c13157871f6..245a28dfde27c6194f49ce90ea55271f29351701 100644 (file)
@@ -1002,7 +1002,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;
        }
@@ -1206,6 +1211,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 */
@@ -1232,9 +1242,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);
@@ -1247,12 +1254,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 e2395be3a56ec3811b35f335b44f927afc180eb4..c69c088878fdc3f1e5064a506d5f23cef0d8b976 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;
       }