]> git.apps.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>
Wed, 8 Mar 2017 12:05:47 +0000 (13:05 +0100)
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 b87c388cb665a1fd5be361c9edb35579f9a3c05e..4e3723712196fa04d00f8602f933f7cfecf354f9 100644 (file)
@@ -1289,9 +1289,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);