Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp830567imu; Wed, 16 Jan 2019 08:15:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN58VlQOMsXwcJc+Fye8CyLu4gzZc1F+tYdz/s75vT9RW5zikC6p09hDc14U4LESdDigihi6 X-Received: by 2002:a62:931a:: with SMTP id b26mr10958790pfe.65.1547655354195; Wed, 16 Jan 2019 08:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547655354; cv=none; d=google.com; s=arc-20160816; b=tknBhPuRrKs5k5JKI11HRjjAvowD39ojBvM1s42O9a0Cj5Ucl/X/sqmVWd1RUYV8gn lOxJZ99QpRqSJKIWn1S2ur1ugTpNO9VIYPzmk/aAo3BnneGToXsJ3fx2cc79MaKjdR55 hpuOjUrmcl1VVogCn6RTp9Jwryj2oDODAbRoXWKLn6Lj7IDD4sife8CUmbLglh4jcl2g P8kZn86OuucQQJtHVggT4cXpJRoHqkMyFXZQ1KE4Y8LQ3imLdDtwfwHDkBGELvv/mQe5 xvY2DgLwjH5MpN1BqXg+CXi2W84QjrbUBiBliEOVCWucTg89ZwoOGYpHcLU6apVpEntF ob4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:subject:cc:to :from:date:dkim-signature; bh=t2MTQpA8bbMsSvAwKv1f/0jJuFH6Uthqj8WNfEA+dfc=; b=MpZMC/eQXKm0maB7rIRdM8nUto6o/BORrTqYGQqmwfJfHEmncwHrLRuHVs/An2r14m 4swFi7uRzxTGEfwHyYVDdEBLLOMy/MKyTHwkOBNQ7Xo+4VhxKzvyRfgLsssJG4DEROSz 6bAezfQVk1peOnGTpqjvfoYbzh4C7gwaRsjVV1KnB1P56i35GsQ3QrK4qQfEIEpkeNl1 CjGQ7MJpdST3QHc5CGO8UHmVajU9YyPE9P8ppGvHy6xEp+a6PfFocVjsyRapalVS5zoK TeEXa8v8MZTh3cnbmJxi7rQWvitz/8nHmz4INYCiZJHCkOUFmwKZPcnTY7fXLPmeAlpr gr1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=kLN1ZdS6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si6545756pgc.232.2019.01.16.08.15.27; Wed, 16 Jan 2019 08:15:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=kLN1ZdS6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728548AbfAPCZ1 (ORCPT + 99 others); Tue, 15 Jan 2019 21:25:27 -0500 Received: from ozlabs.org ([203.11.71.1]:41011 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728305AbfAPCZ1 (ORCPT ); Tue, 15 Jan 2019 21:25:27 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43fWJg5tNDz9sDr; Wed, 16 Jan 2019 13:25:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1547605524; bh=QjqsECc4U44FzF2BnrUmH1TChEJHXPTFnSAWy1tmHdg=; h=Date:From:To:Cc:Subject:From; b=kLN1ZdS62GyL3O/g+USPZg7g85ipEy2ig/qIT0cqlLz7Xq0hROwE1vKH98w4BrR7A 5ZSRxb7zyu1g2rlq1+LZURwAhqhQXBBQF9SQPArQuxrfmBco2/YmjclDiTEgD/sow2 rj/MBpmqc1SwyLaKhfjhI9MiMk+JR6DAvjaF5fyaGRFHsmOx5rGoXEq3iWibpG6AbI NH+Li9HhMeISjQi1IFNsWG8HajMoms0Lr9Hp/D3aGhrhllfuUqKOxADX4cW5ww6pbg kXlzsNS8k/uL+blBPKf8J7ZcmULucmKopOaRbxDNeyoUsl+Ts2O3P6hHu40PngUpAS vu8r0j1F//a6g== Date: Wed, 16 Jan 2019 13:25:22 +1100 From: Stephen Rothwell To: Jens Axboe , Theodore Ts'o Cc: Linux Next Mailing List , Linux Kernel Mailing List , Ming Lei , Eric Biggers Subject: linux-next: manual merge of the block tree with the fscrypt tree Message-ID: <20190116132522.1b756433@canb.auug.org.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/NvUAs=meH/sMEJp+jrWm.nU"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/NvUAs=meH/sMEJp+jrWm.nU Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi all, Today's linux-next merge of the block tree got a conflict in: fs/ext4/readpage.c between commit: acc9eb0a6073 ("ext4: add fs-verity read support") from the fscrypt tree and commit: eb754eb2a953 ("block: allow bio_for_each_segment_all() to iterate over mu= lti-page bvec") from the block tree. I fixed it up (see below - the former moved the code modified by the latter) 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. --=20 Cheers, Stephen Rothwell diff --cc fs/ext4/readpage.c index 0b353a0634f3,e53639784892..000000000000 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@@ -61,124 -56,6 +61,125 @@@ static inline bool ext4_bio_encrypted(s #endif } =20 +/* postprocessing steps for read bios */ +enum bio_post_read_step { + STEP_INITIAL =3D 0, + STEP_DECRYPT, + STEP_VERITY, +}; + +struct bio_post_read_ctx { + struct bio *bio; + struct work_struct work; + unsigned int cur_step; + unsigned int enabled_steps; +}; + +static void __read_end_io(struct bio *bio) +{ + struct page *page; + struct bio_vec *bv; + int i; ++ struct bvec_iter_all iter_all; + - bio_for_each_segment_all(bv, bio, i) { ++ bio_for_each_segment_all(bv, bio, i, iter_all) { + page =3D bv->bv_page; + + /* PG_error was set if any post_read step failed */ + if (bio->bi_status || PageError(page)) { + ClearPageUptodate(page); + SetPageError(page); + } else { + SetPageUptodate(page); + } + unlock_page(page); + } + if (bio->bi_private) + mempool_free(bio->bi_private, bio_post_read_ctx_pool); + bio_put(bio); +} + +static void bio_post_read_processing(struct bio_post_read_ctx *ctx); + +static void decrypt_work(struct work_struct *work) +{ + struct bio_post_read_ctx *ctx =3D + container_of(work, struct bio_post_read_ctx, work); + + fscrypt_decrypt_bio(ctx->bio); + + bio_post_read_processing(ctx); +} + +static void verity_work(struct work_struct *work) +{ + struct bio_post_read_ctx *ctx =3D + container_of(work, struct bio_post_read_ctx, work); + + fsverity_verify_bio(ctx->bio); + + bio_post_read_processing(ctx); +} + +static void bio_post_read_processing(struct bio_post_read_ctx *ctx) +{ + /* + * We use different work queues for decryption and for verity because + * verity may require reading metadata pages that need decryption, and + * we shouldn't recurse to the same workqueue. + */ + switch (++ctx->cur_step) { + case STEP_DECRYPT: + if (ctx->enabled_steps & (1 << STEP_DECRYPT)) { + INIT_WORK(&ctx->work, decrypt_work); + fscrypt_enqueue_decrypt_work(&ctx->work); + return; + } + ctx->cur_step++; + /* fall-through */ + case STEP_VERITY: + if (ctx->enabled_steps & (1 << STEP_VERITY)) { + INIT_WORK(&ctx->work, verity_work); + fsverity_enqueue_verify_work(&ctx->work); + return; + } + ctx->cur_step++; + /* fall-through */ + default: + __read_end_io(ctx->bio); + } +} + +static struct bio_post_read_ctx *get_bio_post_read_ctx(struct inode *inod= e, + struct bio *bio, + pgoff_t index) +{ + unsigned int post_read_steps =3D 0; + struct bio_post_read_ctx *ctx =3D NULL; + + if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode)) + post_read_steps |=3D 1 << STEP_DECRYPT; +#ifdef CONFIG_FS_VERITY + if (inode->i_verity_info !=3D NULL && + (index < ((i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT))) + post_read_steps |=3D 1 << STEP_VERITY; +#endif + if (post_read_steps) { + ctx =3D mempool_alloc(bio_post_read_ctx_pool, GFP_NOFS); + if (!ctx) + return ERR_PTR(-ENOMEM); + ctx->bio =3D bio; + ctx->enabled_steps =3D post_read_steps; + bio->bi_private =3D ctx; + } + return ctx; +} + +static bool bio_post_read_required(struct bio *bio) +{ + return bio->bi_private && !bio->bi_status; +} + /* * I/O completion handler for multipage BIOs. * --Sig_/NvUAs=meH/sMEJp+jrWm.nU Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAlw+lhMACgkQAVBC80lX 0GwFNQf+JCtgpfzQTW7gsQzb5syKDYH6gI/l6aGiws6qDefqPb32lAJmjRxAZOSk 2D+T9GiZV1bpK8+XxrM/I46tYI/qeCgJwlFwO/qFE0Zl2/lsdidRvhuC0MIj3H0g +9LnZLSn2w+IbWbeq5xbfVTdbO71xmlYw3A+3SrJBhsDx2UkJkl/R9VENLCrWfkK 92rfhnSMJ8dtoOH2SwihZnecdxXzDFTduzH33p3/DzJa4f39DNuSFGiW+r6CZxHn oRGXaqLQTio+utjFU1U7u3hfBHyDggXJXBeYT1wkVPovaLvEHEZolqR8I/cZ5xQo 9uGWudHYBJotvMagxGl0xhYZrM9N2Q== =EqWE -----END PGP SIGNATURE----- --Sig_/NvUAs=meH/sMEJp+jrWm.nU--