diff options
author | Luís Henriques <lhenriques@suse.de> | 2022-08-25 09:31:28 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2023-08-24 11:24:36 +0200 |
commit | dd66df0053ef84add5e684df517aa9b498342381 (patch) | |
tree | 07c129147759b750392551d1f71dcf71321e5436 /fs/ceph/crypto.h | |
parent | b422f115044328e1753d6c1e3bb4955b4ca5df27 (diff) |
ceph: add support for encrypted snapshot names
Since filenames in encrypted directories are encrypted and shown as
a base64-encoded string when the directory is locked, make snapshot
names show a similar behaviour.
When creating a snapshot, .snap directories for every subdirectory will
show the snapshot name in the "long format":
# mkdir .snap/my-snap
# ls my-dir/.snap/
_my-snap_1099511627782
Encrypted snapshots will need to be able to handle these by
encrypting/decrypting only the snapshot part of the string ('my-snap').
Also, since the MDS prevents snapshot names to be bigger than 240
characters it is necessary to adapt CEPH_NOHASH_NAME_MAX to accommodate
this extra limitation.
[ idryomov: drop const on !CONFIG_FS_ENCRYPTION branch too ]
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>
Diffstat (limited to 'fs/ceph/crypto.h')
-rw-r--r-- | fs/ceph/crypto.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h index 6afa6d888fe0..47e0c319fc68 100644 --- a/fs/ceph/crypto.h +++ b/fs/ceph/crypto.h @@ -102,10 +102,10 @@ int ceph_fscrypt_prepare_context(struct inode *dir, struct inode *inode, struct ceph_acl_sec_ctx *as); void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req, struct ceph_acl_sec_ctx *as); -int ceph_encode_encrypted_dname(const struct inode *parent, - struct qstr *d_name, char *buf); -int ceph_encode_encrypted_fname(const struct inode *parent, - struct dentry *dentry, char *buf); +int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name, + char *buf); +int ceph_encode_encrypted_fname(struct inode *parent, struct dentry *dentry, + char *buf); static inline int ceph_fname_alloc_buffer(struct inode *parent, struct fscrypt_str *fname) @@ -194,14 +194,14 @@ static inline void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req, { } -static inline int ceph_encode_encrypted_dname(const struct inode *parent, +static inline int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name, char *buf) { memcpy(buf, d_name->name, d_name->len); return d_name->len; } -static inline int ceph_encode_encrypted_fname(const struct inode *parent, +static inline int ceph_encode_encrypted_fname(struct inode *parent, struct dentry *dentry, char *buf) { return -EOPNOTSUPP; |