]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix the cross-quota rename boundary check conditions 14667/head
authorGreg Farnum <gfarnum@redhat.com>
Wed, 14 Dec 2016 20:09:44 +0000 (12:09 -0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 20 Apr 2017 10:43:54 +0000 (12:43 +0200)
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>
(cherry picked from commit 8e8892aa46accb519faa4bb9fecf66618f1b11b2)

Conflicts:
        src/client/Client.cc (do not pass perm to get_quota_root() because
        jewel does not have 3caa4d233633fb7a67747f2c79c4a0ab89112294)

src/client/Client.cc

index 2d3284b76dce8d0cfa1002e1a3de1d1a8938c862..616a8b2273cc098f5ae434ecfeba0d678e0b2186 100644 (file)
@@ -10929,11 +10929,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) != get_quota_root(todir))) {
-    return -EXDEV;
+      fromdir != todir) {
+    Inode *fromdir_root =
+      fromdir->quota.is_enable() ? fromdir : get_quota_root(fromdir);
+    Inode *todir_root =
+      todir->quota.is_enable() ? todir : get_quota_root(todir);
+    if (fromdir_root != todir_root) {
+      return -EXDEV;
+    }
   }
 
   InodeRef target;