From: Greg Farnum Date: Wed, 14 Dec 2016 20:09:44 +0000 (-0800) Subject: client: fix the cross-quota rename boundary check conditions X-Git-Tag: v10.2.8~50^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=82ea0971b3cb07c32ec837cb85de63d4068a70d7;p=ceph.git client: fix the cross-quota rename boundary check conditions 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 (cherry picked from commit 8e8892aa46accb519faa4bb9fecf66618f1b11b2) Conflicts: src/client/Client.cc (do not pass perm to get_quota_root() because jewel does not have 3caa4d233633fb7a67747f2c79c4a0ab89112294) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 2d3284b76dce..616a8b2273cc 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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;