]> 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)
committerNathan Cutler <ncutler@suse.com>
Tue, 4 Jul 2017 07:36:17 +0000 (09:36 +0200)
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>
(cherry picked from commit dea8d1ee373399a21851690a9753388b659b8ede)

src/rgw/rgw_file.cc

index b4389c745e1ffb9f0a7b073c013232fd92bcaca8..b96945b04414c9165082e2d7f3a1e4b21b37bbac 100644 (file)
@@ -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);