f2fs, dm-default-key: should skip dm-default-key only for FBE blocks

GC moves data blocks when they require post_read_process. If the blocks
were encrypted by FBE, we had to skip another encryption by dm-default-key. [1]

Fsverity borrows the above IO flow when moving the blocks, but we missed that
we shoud move plain blocks if they're not FBE blocks, since dm-default-key
will use original LBA for DUN when decrypting the moved block like below.

1. GC w/o this patch (bi_crypt_skip=1)

FS: Verity non-FBE block   LBA#1                 ->    LBA#2
    (block A)
                           Encrypted_DUN(LBA#1)  ->    Encrypted_DUN(LBA#1)
                           |                           |
DM:                        Encrypted_DUN(LBA#1)        Encrypted_DUN(LBA#1)

When reading LBA#2, the block is decrypted by DUN#LAB#1, which is wrong.

2. GC w/ this patch (bi_crypt_skip=0)

FS: Verity non-FBE block   LBA#1                 ->    LBA#2
    (block A)
                           Decrypted(block A)    ->    Decrypted(block A)
                           |                           |
DM:                        Encrypted_DUN(LBA#1)        Encrypted_DUN(LBA#2)

[1] commit af4ef71b89c5 ("dm-default-key, f2fs, ICE: support dm-default-key with f2fs/ICE")

Change-Id: I0ed594749f4037a675e636bdb55a6a318960f44d
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
1 file changed