]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix purging snapshotted stray inode
authorYan, Zheng <zyan@redhat.com>
Tue, 10 Mar 2015 11:13:30 +0000 (19:13 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 18 Mar 2015 06:25:44 +0000 (14:25 +0800)
If stray inode has no snapshot data, it's OK to purge it even if
it's still referenced by some snapsthots. This is because seperate
snap inodes were created for snapshots.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDCache.cc

index d7dbf219060aaef6f7a79a6df9fd30562b604ad3..2b5ee948d0c03172464b260482e971dbfbdde6b0 100644 (file)
@@ -9012,6 +9012,7 @@ void MDCache::eval_stray(CDentry *dn, bool delay)
          !in->snaprealm->open_parents(new C_MDC_EvalStray(this, dn)))
        return;
       in->snaprealm->prune_past_parents();
+      in->purge_stale_snap_data(in->snaprealm->get_snaps());
     }
     if (in->is_dir()) {
       if (in->snaprealm && in->snaprealm->has_past_parents()) {
@@ -9056,7 +9057,9 @@ void MDCache::eval_stray(CDentry *dn, bool delay)
        num_strays_delayed++;
        logger->set(l_mdc_num_strays_delayed, num_strays_delayed);
       }
-    } else if (in->snaprealm && in->snaprealm->has_past_parents()) {
+    // don't purge multiversion inode with snap data
+    } else if (in->snaprealm && in->snaprealm->has_past_parents() &&
+              !in->old_inodes.empty()) {
       assert(!in->is_dir());
       dout(20) << " file has past parents " << in->snaprealm->srnode.past_parents << dendl;
       if (in->is_file() && in->get_projected_inode()->size > 0)