Skip to content

Commit c526760

Browse files
jtlaytonidryomov
authored andcommitted
ceph: make d_revalidate call fscrypt revalidator for encrypted dentries
If we have a dentry which represents a no-key name, then we need to test whether the parent directory's encryption key has since been added. Do that before we test anything else about the dentry. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent cb3524a commit c526760

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

fs/ceph/dir.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,10 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
17821782
struct inode *dir, *inode;
17831783
struct ceph_mds_client *mdsc;
17841784

1785+
valid = fscrypt_d_revalidate(dentry, flags);
1786+
if (valid <= 0)
1787+
return valid;
1788+
17851789
if (flags & LOOKUP_RCU) {
17861790
parent = READ_ONCE(dentry->d_parent);
17871791
dir = d_inode_rcu(parent);
@@ -1794,8 +1798,9 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
17941798
inode = d_inode(dentry);
17951799
}
17961800

1797-
dout("d_revalidate %p '%pd' inode %p offset 0x%llx\n", dentry,
1798-
dentry, inode, ceph_dentry(dentry)->offset);
1801+
dout("d_revalidate %p '%pd' inode %p offset 0x%llx nokey %d\n", dentry,
1802+
dentry, inode, ceph_dentry(dentry)->offset,
1803+
!!(dentry->d_flags & DCACHE_NOKEY_NAME));
17991804

18001805
mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
18011806

0 commit comments

Comments
 (0)