Subject: linux-next: manual merge of the mm tree with the fsverity tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 10 Jan 2023 13:25:19 +1100

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  fs/buffer.c

between commit:

  2a042de143b2 ("fs/buffer.c: support fsverity in block_read_full_folio()")

from the fsverity tree and commit:

  a0ab20df28e6 ("buffer: replace obvious uses of b_page with b_folio")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/buffer.c
index 2e65ba2b3919,7e42d67bcaad..000000000000
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@@ -352,24 -319,15 +352,24 @@@ static void decrypt_bh(struct work_stru
   */
  static void end_buffer_async_read_io(struct buffer_head *bh, int uptodate)
  {
- 	struct inode *inode = bh->b_page->mapping->host;
 -	/* Decrypt if needed */
 -	if (uptodate &&
 -	    fscrypt_inode_uses_fs_layer_crypto(bh->b_folio->mapping->host)) {
 -		struct decrypt_bh_ctx *ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
++	struct inode *inode = bh->b_folio->mapping->host;
 +	bool decrypt = fscrypt_inode_uses_fs_layer_crypto(inode);
 +	bool verify = need_fsverity(bh);
 +
 +	/* Decrypt (with fscrypt) and/or verify (with fsverity) if needed. */
 +	if (uptodate && (decrypt || verify)) {
 +		struct postprocess_bh_ctx *ctx =
 +			kmalloc(sizeof(*ctx), GFP_ATOMIC);
  
  		if (ctx) {
 -			INIT_WORK(&ctx->work, decrypt_bh);
  			ctx->bh = bh;
 -			fscrypt_enqueue_decrypt_work(&ctx->work);
 +			if (decrypt) {
 +				INIT_WORK(&ctx->work, decrypt_bh);
 +				fscrypt_enqueue_decrypt_work(&ctx->work);
 +			} else {
 +				INIT_WORK(&ctx->work, verify_bh);
 +				fsverity_enqueue_verify_work(&ctx->work);
 +			}
  			return;
  		}
  		uptodate = 0;