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: v12.0.1~287^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dea8d1ee373399a21851690a9753388b659b8ede;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 --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 4e5108c87e66..1803109ddedb 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1377,9 +1377,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);