Skip to content

Commit abd4fc7

Browse files
Luís Henriquesidryomov
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Milind Changire <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent dd66df0 commit abd4fc7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/ceph/dir.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,11 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
10901090
err = -EDQUOT;
10911091
goto out;
10921092
}
1093+
if ((op == CEPH_MDS_OP_MKSNAP) && IS_ENCRYPTED(dir) &&
1094+
!fscrypt_has_encryption_key(dir)) {
1095+
err = -ENOKEY;
1096+
goto out;
1097+
}
10931098

10941099

10951100
req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);

0 commit comments

Comments
 (0)