]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Handle empty relpath from client getattr
authorSam Lang <sam.lang@inktank.com>
Wed, 26 Sep 2012 00:55:05 +0000 (17:55 -0700)
committerSam Lang <sam.lang@inktank.com>
Wed, 26 Sep 2012 01:06:31 +0000 (18:06 -0700)
A bug in the client (see 2b54391) results in an empty relpath on
a lookup request.  This causes a segfault in the mds, because the
getattr logic expects a lookup to have a relpath to place in the
response.  The fix here ensures that lookups include a non-empty
relpath, o.w. aborting the request and returning -EINVAL to the
client.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
src/mds/Server.cc

index dcdc75add0da74c863a8033efab7574b3562e4fd..7b928948609767736876dcf1efe9cb67e85b1938 100644 (file)
@@ -1872,6 +1872,12 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n,
   if (mdr->done_locking)
     return mdr->in[n];
 
+  if (!no_lookup && 0 == refpath.depth()) {
+    // refpath can't be empty for lookup but it can for
+    // getattr (we do getattr with empty refpath for mount of '/')
+    reply_request(mdr, -EINVAL);
+    return 0;
+  }
 
   // traverse
   int r = mdcache->path_traverse(mdr, NULL, NULL, refpath, &mdr->dn[n], &mdr->in[n], MDS_TRAVERSE_FORWARD);