]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mdcache: handle unreadable null dentries
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 22 Aug 2011 22:00:18 +0000 (15:00 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 22 Aug 2011 23:00:35 +0000 (16:00 -0700)
Previously, we were asserting (farther down) if the dentry was
null but blocked by a lock. Instead, we should here be waiting
until it's readable instead of just continuing on.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mds/MDCache.cc

index 902ab04ac8271bec27798770a4751682d436463a..2de901553d9ba9556ec5272179e2dda4a7189398 100644 (file)
@@ -6683,9 +6683,15 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req, Context *fin,     // wh
     }
     
     // can we conclude ENOENT?
-    if (dnl && dnl->is_null() && dn->lock.can_read(client)) {
-      dout(12) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl;
-      return -ENOENT;
+    if (dnl && dnl->is_null()) {
+      if (dn->lock.can_read(client)) {
+        dout(12) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl;
+        return -ENOENT;
+      } else {
+        dout(12) << "miss on dentry " << *dn << ", can't read due to lock" << dendl;
+        dn->lock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req, fin));
+        return 1;
+      }
     }
 
     if (dnl && !dnl->is_null()) {