Commit c5267601 authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov
Browse files

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: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
Reviewed-and-tested-by: default avatarLuís Henriques <lhenriques@suse.de>
Reviewed-by: default avatarMilind Changire <mchangir@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent cb3524a8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1782,6 +1782,10 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
	struct inode *dir, *inode;
	struct ceph_mds_client *mdsc;

	valid = fscrypt_d_revalidate(dentry, flags);
	if (valid <= 0)
		return valid;

	if (flags & LOOKUP_RCU) {
		parent = READ_ONCE(dentry->d_parent);
		dir = d_inode_rcu(parent);
@@ -1794,8 +1798,9 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
		inode = d_inode(dentry);
	}

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

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