fscrypt: allow synchronous bio decryption
authorEric Biggers <ebiggers@google.com>
Wed, 18 Apr 2018 18:09:47 +0000 (11:09 -0700)
committerJaegeuk Kim <jaegeuk@google.com>
Sat, 21 Apr 2018 05:33:42 +0000 (22:33 -0700)
commit61760b0be333584661bb029f0d071dc9baa1d84a
treecfc372976af4161cc4aa616854a80484b66912f7
parent1e9871d06e9587d914510865c49bd49d1d73947c
fscrypt: allow synchronous bio decryption

Cherry-pick from origin/upstream-f2fs-stable-linux-4.14.y:
  fac0e4a8acde ("fscrypt: allow synchronous bio decryption")

Currently, fscrypt provides fscrypt_decrypt_bio_pages() which decrypts a
bio's pages asynchronously, then unlocks them afterwards.  But, this
assumes that decryption is the last "postprocessing step" for the bio,
so it's incompatible with additional postprocessing steps such as
authenticity verification after decryption.

Therefore, rename the existing fscrypt_decrypt_bio_pages() to
fscrypt_enqueue_decrypt_bio().  Then, add fscrypt_decrypt_bio() which
decrypts the pages in the bio synchronously without unlocking the pages,
nor setting them Uptodate; and add fscrypt_enqueue_decrypt_work(), which
enqueues work on the fscrypt_read_workqueue.  The new functions will be
used by filesystems that support both fscrypt and fs-verity.

Change-Id: I87514f59bcf1d2cec858bb44f6e27652ba0e93eb
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/crypto/bio.c
fs/crypto/crypto.c
fs/crypto/fscrypt_private.h
fs/ext4/readpage.c
fs/f2fs/data.c
include/linux/fscrypt_notsupp.h
include/linux/fscrypt_supp.h