From: Jeff Layton Date: Mon, 28 Mar 2022 20:18:38 +0000 (-0400) Subject: ceph: set DCACHE_NOKEY_NAME in atomic open X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cf18ea91cfdabd242c08cca60dabe4c5d68b372;p=ceph-client.git ceph: set DCACHE_NOKEY_NAME in atomic open Atomic open can act as a lookup if handed a dentry that is negative on the MDS. Ensure that we set DCACHE_NOKEY_NAME on the dentry in atomic_open, if we don't have the key for the parent. Otherwise, we can end up validating the dentry inappropriately if someone later adds a key. Reviewed-by: Luís Henriques Reviewed-by: Xiubo Li Signed-off-by: Jeff Layton --- diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d6a244a239c7..04a2cc39da2d 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -779,6 +779,13 @@ retry: req->r_args.open.mask = cpu_to_le32(mask); req->r_parent = dir; ihold(dir); + if (IS_ENCRYPTED(dir)) { + if (!fscrypt_has_encryption_key(dir)) { + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_NOKEY_NAME; + spin_unlock(&dentry->d_lock); + } + } if (flags & O_CREAT) { struct ceph_file_layout lo;