]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: avoid scrubbing (CDir*)NULL
authorYan, Zheng <zyan@redhat.com>
Thu, 17 Mar 2016 12:00:36 +0000 (20:00 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 17 Mar 2016 12:06:22 +0000 (20:06 +0800)
If dirfrags get fragmented in the middle of scrubbing, get_dirfrag()
can return NULL.

Fixes: #15167
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/ScrubStack.cc

index 1eaddf65fb9d7b6537b5a23772277a67825ad20f..7da1b4bb5093f4120fb95ff2e5bd006b4d86b15f 100644 (file)
@@ -146,11 +146,15 @@ void ScrubStack::scrub_dir_inode(CInode *in,
        ++i) {
       // turn frags into CDir *
       CDir *dir = in->get_dirfrag(*i);
-      scrubbing_cdirs.push_back(dir);
-      dout(25) << __func__ << " got CDir " << *dir << " presently scrubbing" << dendl;
+      if (dir) {
+       scrubbing_cdirs.push_back(dir);
+       dout(25) << __func__ << " got CDir " << *dir << " presently scrubbing" << dendl;
+      } else {
+       in->scrub_dirfrag_finished(*i);
+       dout(25) << __func__ << " missing dirfrag " << *i << " skip scrubbing" << dendl;
+      }
     }
 
-
     dout(20) << __func__ << " consuming from " << scrubbing_cdirs.size()
             << " scrubbing cdirs" << dendl;