]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix the cross-quota rename boundary check conditions 12489/head
authorGreg Farnum <gfarnum@redhat.com>
Wed, 14 Dec 2016 20:09:44 +0000 (12:09 -0800)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 12 Jan 2017 22:30:09 +0000 (14:30 -0800)
We were previously rejecting a rename if either of the involved directories
was a quota root, even if the other directory was part of the same quota
"tree". What we really want to do is identify the correct quota root
(whether local or ancestral) for each directory and compare them. So
now we do.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc

index ff3618f27c21819f397e37125bed752e5e19829b..8196df45328ffc22d93f7308a58c85803979fdea 100644 (file)
@@ -11524,11 +11524,14 @@ int Client::_rename(Inode *fromdir, const char *fromname, Inode *todir, const ch
       return -EROFS;
   }
   if (cct->_conf->client_quota &&
-      fromdir != todir &&
-      (fromdir->quota.is_enable() ||
-       todir->quota.is_enable() ||
-       get_quota_root(fromdir, perm) != get_quota_root(todir, perm))) {
-    return -EXDEV;
+      fromdir != todir) {
+    Inode *fromdir_root =
+      fromdir->quota.is_enable() ? fromdir : get_quota_root(fromdir, perm);
+    Inode *todir_root =
+      todir->quota.is_enable() ? todir : get_quota_root(todir, perm);
+    if (fromdir_root != todir_root) {
+      return -EXDEV;
+    }
   }
 
   InodeRef target;