ceph: prevent snapshot creation in encrypted locked directories

With snapshot names encryption we can not allow snapshots to be created in
locked directories because the names wouldn't be encrypted.  This patch
forces the directory to be unlocked to allow a snapshot to be created.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Luís Henriques 2022-08-25 09:31:31 -04:00 committed by Ilya Dryomov
parent dd66df0053
commit abd4fc7758
1 changed files with 5 additions and 0 deletions

View File

@ -1090,6 +1090,11 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
err = -EDQUOT;
goto out;
}
if ((op == CEPH_MDS_OP_MKSNAP) && IS_ENCRYPTED(dir) &&
!fscrypt_has_encryption_key(dir)) {
err = -ENOKEY;
goto out;
}
req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);