diff options
| author | Eric Biggers <ebiggers@google.com> | 2017-10-18 20:21:58 -0400 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2017-10-18 20:21:58 -0400 |
| commit | 8990427501a744c1d523a9da6123f60889efaa03 (patch) | |
| tree | f55d2eb4848c7cfd9b4e0cad7a593952a0679f8e /fs/ext4 | |
| parent | 07543d164ba79e34c61f0f8aeb4af9cd86c88d2c (diff) | |
ext4: switch to fscrypt_prepare_lookup()
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/namei.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index b2fbc2b87bcf..a6b6f09e0a88 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
| @@ -1538,24 +1538,14 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi | |||
| 1538 | struct inode *inode; | 1538 | struct inode *inode; |
| 1539 | struct ext4_dir_entry_2 *de; | 1539 | struct ext4_dir_entry_2 *de; |
| 1540 | struct buffer_head *bh; | 1540 | struct buffer_head *bh; |
| 1541 | int err; | ||
| 1541 | 1542 | ||
| 1542 | if (ext4_encrypted_inode(dir)) { | 1543 | err = fscrypt_prepare_lookup(dir, dentry, flags); |
| 1543 | int res = fscrypt_get_encryption_info(dir); | 1544 | if (err) |
| 1544 | 1545 | return ERR_PTR(err); | |
| 1545 | /* | ||
| 1546 | * DCACHE_ENCRYPTED_WITH_KEY is set if the dentry is | ||
| 1547 | * created while the directory was encrypted and we | ||
| 1548 | * have access to the key. | ||
| 1549 | */ | ||
| 1550 | if (fscrypt_has_encryption_key(dir)) | ||
| 1551 | fscrypt_set_encrypted_dentry(dentry); | ||
| 1552 | fscrypt_set_d_op(dentry); | ||
| 1553 | if (res && res != -ENOKEY) | ||
| 1554 | return ERR_PTR(res); | ||
| 1555 | } | ||
| 1556 | 1546 | ||
| 1557 | if (dentry->d_name.len > EXT4_NAME_LEN) | 1547 | if (dentry->d_name.len > EXT4_NAME_LEN) |
| 1558 | return ERR_PTR(-ENAMETOOLONG); | 1548 | return ERR_PTR(-ENAMETOOLONG); |
| 1559 | 1549 | ||
| 1560 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 1550 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| 1561 | if (IS_ERR(bh)) | 1551 | if (IS_ERR(bh)) |
