From: Matt Benjamin Date: Wed, 22 Feb 2017 19:57:59 +0000 (-0500) Subject: rgw_file: rgw_lookup: don't ref for "/" or ".." X-Git-Tag: v11.2.1~16^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f97ab40539385494f9d4a66806c2bfc08d3654bb;p=ceph.git rgw_file: rgw_lookup: don't ref for "/" or ".." These refs won't be returned by nfs-ganesha, and are sufficiently magical that other consumers should be persuaded to understand their specialness. Fixes: http://tracker.ceph.com/issues/19060 Signed-off-by: Matt Benjamin (cherry picked from commit dea8d1ee373399a21851690a9753388b659b8ede) --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index b4389c745e1..b96945b0441 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1432,9 +1432,10 @@ int rgw_lookup(struct rgw_fs *rgw_fs, LookupFHResult fhr; if (parent->is_root()) { - /* special: lookup on root itself */ - if (strcmp(path, "/") == 0) { - rgw_fh = fs->ref(parent); + /* special: parent lookup--note lack of ref()! */ + if (unlikely((strcmp(path, "..") == 0) || + (strcmp(path, "/") == 0))) { + rgw_fh = parent; } else { fhr = fs->stat_bucket(parent, path, RGWFileHandle::FLAG_NONE); rgw_fh = get<0>(fhr);