diff options
author | David Gstir <david@sigma-star.at> | 2016-11-13 22:20:45 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-14 00:53:10 +0100 |
commit | b50f7b268bad8088dfe7579a65cd910d8cc5c40f (patch) | |
tree | 7a4db96f6779146e5b9df84bd7d1cbb0d10e1032 /fs/ext4/inode.c | |
parent | fscrypt: Add in-place encryption mode (diff) | |
download | linux-b50f7b268bad8088dfe7579a65cd910d8cc5c40f.tar.xz linux-b50f7b268bad8088dfe7579a65cd910d8cc5c40f.zip |
fscrypt: Allow fscrypt_decrypt_page() to function with non-writeback pages
Some filesystem might pass pages which do not have page->mapping->host
set to the encrypted inode. We want the caller to explicitly pass the
corresponding inode.
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9c064727ed62..4b7b842ec024 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1166,7 +1166,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, if (unlikely(err)) page_zero_new_buffers(page, from, to); else if (decrypt) - err = fscrypt_decrypt_page(page); + err = fscrypt_decrypt_page(page->mapping->host, page); return err; } #endif @@ -3743,7 +3743,8 @@ static int __ext4_block_zero_page_range(handle_t *handle, /* We expect the key to be set. */ BUG_ON(!fscrypt_has_encryption_key(inode)); BUG_ON(blocksize != PAGE_SIZE); - WARN_ON_ONCE(fscrypt_decrypt_page(page)); + WARN_ON_ONCE(fscrypt_decrypt_page(page->mapping->host, + page)); } } if (ext4_should_journal_data(inode)) { |