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>
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);