From eb12e3a7524fcbc009cabda333a6a958390743bd Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 14 Dec 2016 12:09:44 -0800 Subject: [PATCH] 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) --- src/client/Client.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 81be35b9835..34f8d3c097a 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11557,11 +11557,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; -- 2.47.3