Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp104566pxj; Wed, 16 Jun 2021 21:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw61jD58bs9Di0l+gBlsCevmJ1Yx1F4HjTXoFhswEEgdMuOGjXl+sZF9660L8UQk7Nsjipt X-Received: by 2002:a6b:d113:: with SMTP id l19mr2147491iob.207.1623904540021; Wed, 16 Jun 2021 21:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623904540; cv=none; d=google.com; s=arc-20160816; b=zITFG2kRGhx3m/pe3D1rsFB+jFiDX37Cn9wls2P07zoOVMHCvQYpUlZGEBFXnx8Ij7 zkiHxM9QjXcNjfW7+2bB1E18d7CjuSsJSkwN6gc+DgMSbWdI/OfMTRk4CdOIPvOuq1NV e0r+vygLzOu1lYYGQfhKvsiRAU2pXq0GCnnyYHJHxpdD2ls7YpsvF+3S/7ec6VDd8sn5 vzewvov6YWUy9H6/jD5SgF65hJoFitaq2+DzwZLGRk3Q7SDmO2scZ8o7f1uAhDn+kx/A jgpF57XzICgAUsHiSRj2FVamP8HBCKHpJeHBMUP/Wy5ea8Y7G1XFXEZPOYayp0S1HdMv UCcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k+DvaSS8dKXfiKpQNihDPJQU89TuNwxoszTwJxkxJeg=; b=n6DpTgJbiPbDGiSuZ0bRlbEHDVm1ud5HJjiGhK9ncaIWy7u77ps725Vw082886CMJc MrtBlIrBldholULttErZ1Csz8oqr0W3qwntAbgtNwUVcxOoWXbifRnduUdlVlLfaELf4 QiaDZvvwfuESWfrt9l31dDqcFXy2tOcPrzx0FOLU3W7RXlfit4YfZhPjrDLeth3CzmHW rpgYzwuR12RVy3HfpdVIkUT5hGen9n8h0xeyNNbFg+HnKUwfaO8BptFhd2AUs3kJD62V /4EYiMKh3m0TMIe6kAPOJc8c4Sxl/t00Hu1SPHXV1mpiAfZH00xQhOQHYfIl5tDJQ34z d2xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r7oBxu1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si4865262ild.129.2021.06.16.21.35.28; Wed, 16 Jun 2021 21:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r7oBxu1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbhFQEhC (ORCPT + 99 others); Thu, 17 Jun 2021 00:37:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbhFQEhB (ORCPT ); Thu, 17 Jun 2021 00:37:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BF2B613BF; Thu, 17 Jun 2021 04:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623904494; bh=hdAU2EvYyDRmpCAW4XPIVGpByZPe+MkYFJ1VpttRoBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r7oBxu1xBOojP5x2hHn2eEWDnKiHPQnbqdZB2GypBhlAMEo3E+MupDfSOleCnAfT5 KpFIg0YSsKau6XmeP9trKbcQM8mGY0PeXyxF81khTlQ3JUfL3+Ckzb7JQv+qqCG4+v MQlVJTQ6E+uN674TiCMTdU4sVyh9gOhCH1OQbcS8JYRQnBFWb2f6Kv5bDt1o2MWGjP Aum5zy5AtVu7wxRZWpoy4pgTT0JfNpH/1fXs08oET7rXINSk26GvG94cSFboiyZR5z qrUcGPa40fSsMU5WzjF7PzWxyMkM/0KZ1U1JINTMmiRyRG7aPK1rmlDI/AXh+Ky+wt h+2vzItqTy1mA== Date: Wed, 16 Jun 2021 21:34:52 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: Re: [PATCH v3 04/10] block: respect bio_required_sector_alignment() in blk-crypto-fallback Message-ID: References: <20210604195900.2096121-1-satyat@google.com> <20210604195900.2096121-5-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 05:39:20PM -0700, Eric Biggers wrote: > On Fri, Jun 04, 2021 at 07:58:54PM +0000, Satya Tangirala wrote: > > Make blk_crypto_split_bio_if_needed() respect > > bio_required_sector_alignment() when calling bio_split(). Without this, > > blk-crypto-fallback could possibly split a bio in the middle of a data > > unit, and the resulting bios can no longer be encrypted (since encryption > > can only be done on complete crypto data units). > > > > Signed-off-by: Satya Tangirala > > --- > > block/blk-crypto-fallback.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c > > index c322176a1e09..85c813ef670b 100644 > > --- a/block/blk-crypto-fallback.c > > +++ b/block/blk-crypto-fallback.c > > @@ -19,6 +19,7 @@ > > #include > > #include > > > > +#include "blk.h" > > #include "blk-crypto-internal.h" > > > > static unsigned int num_prealloc_bounce_pg = 32; > > @@ -225,6 +226,8 @@ static bool blk_crypto_split_bio_if_needed(struct bio **bio_ptr) > > if (num_sectors < bio_sectors(bio)) { > > struct bio *split_bio; > > > > + num_sectors = round_down(num_sectors, > > + bio_required_sector_alignment(bio)); > > split_bio = bio_split(bio, num_sectors, GFP_NOIO, > > &crypto_bio_split); > > if (!split_bio) { > > -- > > Reviewed-by: Eric Biggers Hmm, on second thought, I don't think this patch makes sense without the patch "block: blk-crypto-fallback: handle data unit split across multiple bvecs" which Satya sent out in his other series (https://lkml.kernel.org/r/20210604210908.2105870-2-satyat@google.com). Either blk-crypto-fallback assumes that the length of every bio_vec is aligned to data_unit_size (this is the status quo), in which case the round_down() is unnecessary, *or* it assumes that only the total length is aligned to data_unit_size, in which case both patches are needed. So I'm thinking these should be combined into one patch. - Eric