aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-04-07 13:58:39 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-05-04 11:44:34 -0400
commitfaac7fd97e0827f959c9d376399b91b37364a567 (patch)
treed1b82026f9b99e83a25aa7822cf98df93bc2f64d
parent8c68084bff7a852252cf91985fa8111ae4673f91 (diff)
f2fs: sync f2fs_lookup() with ext4_lookup()
As for ext4, now that fscrypt_has_permitted_context() correctly handles the case where we have the key for the parent directory but not the child, f2fs_lookup() no longer has to work around it. Also add the same warning message that ext4 uses. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/f2fs/namei.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 98f00a3a7f50..9a5b9fa55318 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -324,9 +324,10 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
324 if (f2fs_encrypted_inode(dir) && 324 if (f2fs_encrypted_inode(dir) &&
325 (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) && 325 (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
326 !fscrypt_has_permitted_context(dir, inode)) { 326 !fscrypt_has_permitted_context(dir, inode)) {
327 bool nokey = f2fs_encrypted_inode(inode) && 327 f2fs_msg(inode->i_sb, KERN_WARNING,
328 !fscrypt_has_encryption_key(inode); 328 "Inconsistent encryption contexts: %lu/%lu",
329 err = nokey ? -ENOKEY : -EPERM; 329 dir->i_ino, inode->i_ino);
330 err = -EPERM;
330 goto err_out; 331 goto err_out;
331 } 332 }
332 return d_splice_alias(inode, dentry); 333 return d_splice_alias(inode, dentry);