From: Christopher Hoffman Date: Thu, 14 Dec 2023 17:13:38 +0000 (+0000) Subject: client: Allow setpolicy only on dir and when it is empty. X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5dadefe6e75ae56fd33a7a4813123be155f4a4e6;p=ceph-ci.git client: Allow setpolicy only on dir and when it is empty. Signed-off-by: Christopher Hoffman --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 87aa982158c..6bf8013449a 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -18198,6 +18198,12 @@ int Client::ll_set_fscrypt_policy_v2(Inode *in, const struct fscrypt_policy_v2& return -EEXIST; } + if (!in->is_dir()) + return -ENOTDIR; + + if (in->is_dir() && in->dir && in->dir->dentries.size() > 0) + return -ENOTEMPTY; + FSCryptContext fsc(cct); fsc.init(policy); fsc.generate_new_nonce();