summaryrefslogtreecommitdiff
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorLuís Henriques <lhenriques@suse.de>2022-11-29 10:39:49 +0000
committerIlya Dryomov <idryomov@gmail.com>2023-08-24 11:24:35 +0200
commit14e034a61c908d4479be1a7ee9fe5b8d3d1f09b8 (patch)
tree5a8a46cbfaed77a5df049eb2036c1aaa58acf2bc /fs/ceph/dir.c
parente127e03009a3a3c26f00d0b2703c6e0e47927aec (diff)
ceph: mark directory as non-complete after loading key
When setting a directory's crypt context, ceph_dir_clear_complete() needs to be called otherwise if it was complete before, any existing (old) dentry will still be valid. This patch adds a wrapper around __fscrypt_prepare_readdir() which will ensure a directory is marked as non-complete if key status changes. [ xiubli: revise commit title per Milind ] Signed-off-by: Luís Henriques <lhenriques@suse.de> 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/dir.c')
-rw-r--r--fs/ceph/dir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 99fdc777dccd..08504afbe242 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -343,8 +343,8 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
ctx->pos = 2;
}
- err = fscrypt_prepare_readdir(inode);
- if (err)
+ err = ceph_fscrypt_prepare_readdir(inode);
+ if (err < 0)
return err;
spin_lock(&ci->i_ceph_lock);
@@ -785,8 +785,8 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
return ERR_PTR(-ENAMETOOLONG);
if (IS_ENCRYPTED(dir)) {
- err = __fscrypt_prepare_readdir(dir);
- if (err)
+ err = ceph_fscrypt_prepare_readdir(dir);
+ if (err < 0)
return ERR_PTR(err);
if (!fscrypt_has_encryption_key(dir)) {
spin_lock(&dentry->d_lock);