From 3cffff2a1abd266abbbc97effd73b79695d29682 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 28 Jun 2013 12:51:07 -0700 Subject: [PATCH] mds/Server: fix LOOKUPSNAP The current LOOKUPSNAP code path was dereferencing mdr->dn[0] and getting SEGV. Instead, set the do_lookup arg to false for getattr so that we do not try to dereference this; for snaps it will always be NULL as we are constructing a fake namespace for the .snap directory. (This happens in the path_traverse, the result of which is to set snapid--without any real dentry). With this fix, snaptest-0.sh passes. Signed-off-by: Sage Weil Reviewed-by: Greg Farnum --- src/mds/Server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index c6f48c2a1f7ae..3140194abdc57 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1167,10 +1167,11 @@ void Server::dispatch_client_request(MDRequest *mdr) // inodes ops. case CEPH_MDS_OP_LOOKUP: - case CEPH_MDS_OP_LOOKUPSNAP: handle_client_getattr(mdr, true); break; + case CEPH_MDS_OP_LOOKUPSNAP: + // lookupsnap does not reference a CDentry; treat it as a getattr case CEPH_MDS_OP_GETATTR: handle_client_getattr(mdr, false); break;