]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: rgw_lookup: don't ref for "/" or ".."
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 22 Feb 2017 19:57:59 +0000 (14:57 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 23 Feb 2017 15:27:35 +0000 (10:27 -0500)
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 <mbenjamin@redhat.com>
src/rgw/rgw_file.cc

index 4e5108c87e66098109bfeba41b32d3095232300f..1803109ddedb8f1990b06e71b47ad828a950c667 100644 (file)
@@ -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);