From: John Spray Date: Mon, 25 Jul 2016 14:09:29 +0000 (+0100) Subject: mds: add assertion in handle_slave_rename_prep X-Git-Tag: ses5-milestone5~272^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F10429%2Fhead;p=ceph.git mds: add assertion in handle_slave_rename_prep This function assumes that the source path does not point to a null dentry, and that path_traverse is therefore setting the passed inode. Candidate code path for crash in http://tracker.ceph.com/issues/16807 Signed-off-by: John Spray --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index a2dcc97d0f91..17db88b1edc0 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -7153,10 +7153,13 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr) // discover srcdn filepath srcpath(mdr->slave_request->srcdnpath); dout(10) << " src " << srcpath << dendl; - CInode *srci; + CInode *srci = nullptr; r = mdcache->path_traverse(mdr, NULL, NULL, srcpath, &trace, &srci, MDS_TRAVERSE_DISCOVERXLOCK); if (r > 0) return; assert(r == 0); + + // srcpath must not point to a null dentry + assert(srci != nullptr); CDentry *srcdn = trace[trace.size()-1]; CDentry::linkage_t *srcdnl = srcdn->get_projected_linkage();