From: Kotresh HR Date: Tue, 26 Apr 2022 07:16:45 +0000 (+0530) Subject: client: Makes quota optional X-Git-Tag: v18.0.0~714^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f365a9a5fe465b5d5cc81e5d4dd136bd8989cc20;p=ceph.git client: Makes quota optional Make quota optional. This commit basically reverts the commit da9f1d829484fe35e6d5839c19afa371e444c194 This is done to give 'mgr' libcephfs connection right to bypass quota. The mgr/volumes plugin maintains configuration files with in the directory where the user has enforced quota. So when the quota is met, certain mgr/volumes apis don't work as intended. e.g., When subvolumegroup quota is met, the group's subvolume removal with '--retain-snapshots' fails. Fixes: https://tracker.ceph.com/issues/53509 Signed-off-by: Kotresh HR --- diff --git a/src/client/Client.cc b/src/client/Client.cc index c35a53521e81..220ba123a848 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11223,9 +11223,9 @@ int Client::statfs(const char *path, struct statvfs *stbuf, ceph_assert(root != nullptr); InodeRef quota_root = root->quota.is_enable() ? root : get_quota_root(root.get(), perms); - // get_quota_root should always give us something - // because client quotas are always enabled - ceph_assert(quota_root != nullptr); + // get_quota_root should always give us something if client quotas are + // enabled + ceph_assert(cct->_conf.get_val("client_quota") == false || quota_root != nullptr); if (quota_root && cct->_conf->client_quota_df && quota_root->quota.max_bytes) { @@ -14081,7 +14081,7 @@ int Client::_rename(Inode *fromdir, const char *fromname, Inode *todir, const ch else return -CEPHFS_EROFS; } - if (fromdir != todir) { + if (cct->_conf.get_val("client_quota") && fromdir != todir) { Inode *fromdir_root = fromdir->quota.is_enable() ? fromdir : get_quota_root(fromdir, perm); Inode *todir_root = @@ -15472,6 +15472,10 @@ Inode *Client::get_quota_root(Inode *in, const UserPerm& perms) { Inode *quota_in = root_ancestor; SnapRealm *realm = in->snaprealm; + + if (!cct->_conf.get_val("client_quota")) + return NULL; + while (realm) { ldout(cct, 10) << __func__ << " realm " << realm->ino << dendl; if (realm->ino != in->ino) { @@ -15497,6 +15501,9 @@ Inode *Client::get_quota_root(Inode *in, const UserPerm& perms) bool Client::check_quota_condition(Inode *in, const UserPerm& perms, std::function test) { + if (!cct->_conf.get_val("client_quota")) + return false; + while (true) { ceph_assert(in != NULL); if (test(*in)) { diff --git a/src/common/options/mds-client.yaml.in b/src/common/options/mds-client.yaml.in index 3e365e770c2e..82fe47054b6f 100644 --- a/src/common/options/mds-client.yaml.in +++ b/src/common/options/mds-client.yaml.in @@ -559,3 +559,13 @@ options: - mds_client flags: - runtime +- name: client_quota + type: bool + level: advanced + desc: Enable quota enforcement + long_desc: Enable quota_bytes and quota_files enforcement for the client. + default: true + services: + - mds_client + flags: + - runtime