]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MDCache: make linkunlink rstat propagation work properly.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Fri, 18 Mar 2011 21:25:45 +0000 (14:25 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 22 Mar 2011 00:18:34 +0000 (17:18 -0700)
We could be in a lock state (ie, gather) where we can't take new locks.
But if we're in this function for linkunlink we have to already have
a lock, so in that case make sure the function succeeds and assert
that we do have a lock.

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

index 8a53ef1b503f74eea0f4f32e2732cdd30aa2ead2..dfb79bf8c47842bce882ac351872d23ed244dfca 100644 (file)
@@ -1874,14 +1874,18 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
     // rstat
     if (!primary_dn) {
       // don't update parent this pass
-    } else if (!parent->inode->nestlock.can_wrlock(-1)) {
+    } else if (!linkunlink && !parent->inode->nestlock.can_wrlock(-1)) {
       dout(20) << " unwritable parent nestlock " << parent->inode->nestlock
               << ", marking dirty rstat on " << *cur << dendl;
-      cur->mark_dirty_rstat();      
+      cur->mark_dirty_rstat();
    } else {
       // if we don't hold a wrlock reference on this nestlock, take one,
       // because we are about to write into the dirfrag fnode and that needs
       // to commit before the lock can cycle.
+     if (linkunlink) {
+       assert(parent->inode->nestlock.get_num_wrlocks());
+     }
+
       if (mut->wrlocks.count(&parent->inode->nestlock) == 0) {
        dout(10) << " taking wrlock on " << parent->inode->nestlock << " on " << *parent->inode << dendl;
        mds->locker->wrlock_force(&parent->inode->nestlock, mut);