From 7fe9c15f0bf74cd5d169117243ea258b3ab70dd9 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 25 Jul 2016 15:09:29 +0100 Subject: [PATCH] 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 --- src/mds/Server.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); -- 2.47.3