Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp847734imm; Fri, 1 Jun 2018 10:31:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJaBjI5po/TNgs3j5USE8JhPQL4aeoP3bh7H9Q4tQn7VSvhs0nv7EdqCX8RaEvpLHp66GDn X-Received: by 2002:a17:902:8d8e:: with SMTP id v14-v6mr12079019plo.387.1527874298927; Fri, 01 Jun 2018 10:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527874298; cv=none; d=google.com; s=arc-20160816; b=Ji7soebwmgI4zdSz5rtA71VeCXa++Hn3bLK0Ml43eRMRhYWRRvAb0zoYaabRB1NY+d c84BzpHSqVvJ5mc42Nyhco/nBCUggcPnygtyjk1P6ALOEDBKFX5Kewdn6JsezK93iXpQ b9y/NJV1jYzSx8hXf0M190o3xHo+Nt7Nvmr3O1ZwZ+nI3xmxLtAa1WktKNu0HKjV5m6C lF9/aHUqEnWDKceMksDy7shX3sj1JgMFDFvD5M7YE274biihT0/f+YxwnutHRjdIrHqa yrPl0K7rdJGL5Qq4OdKuBN8zhcOkce+i5nWtjEW6Ewh/eTvLgyJj7zfsJpTO+s/U+WDr 0f4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=ehYpUKTFI5UExZIAe2uu6clvW9afPkllZjxUxYmCAf8=; b=ZDt62fzq/BkGlFqWU+mXYUxszQ4s3gdiML1o+KcpVScl89HCr33FFxNe3qp939zsz+ OdtzeqrLegMzi0mdYHv4H4MSyaXYBqDZSYyV6hI/BND8XUDMDbSTHOOXF80/j4ayBdcs WniDC7alYTZHlR2c41wx3V57TI/+tYyNRn9tAPL58pmTGYZvxe0/MhIkmJ0GHiVddCrp HXQjL/buB0MttLnhMuS4oICLckNB/PPQYL6V4Go8zDYGrTDQKIRY1jNrqO6hm2V2A1gd WD+OnLiuzOPSzamHMyrsFm6Qiaeovzpr9xXDO5hGppSqXfCMMZAp0zWtViPuBMtTz511 LfbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lOhgwZNy; 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 90-v6si5349739pla.38.2018.06.01.10.31.23; Fri, 01 Jun 2018 10:31:38 -0700 (PDT) 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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lOhgwZNy; 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 S1752556AbeFARa7 (ORCPT + 99 others); Fri, 1 Jun 2018 13:30:59 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:42342 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbeFARa5 (ORCPT ); Fri, 1 Jun 2018 13:30:57 -0400 Received: by mail-io0-f193.google.com with SMTP id a10-v6so30543776ioc.9 for ; Fri, 01 Jun 2018 10:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ehYpUKTFI5UExZIAe2uu6clvW9afPkllZjxUxYmCAf8=; b=lOhgwZNy3mrXoovIjNPM+4cCTBsQodQjTuTSvydUez3DsIbEroZ0sB+hlc6kC/Mj8r SVfNlQg6aq3FW++6F4w2yNmp7H9ug6wLw55zvWfVfmdVtPP56KHFGe4FcEjQwi5EB75x e3z5xWaGypkpoNZmnvhodSAHO3pMW9n1Vg/9BixWkOqh5Hy9e1Z98e9PZ3T3F6a6n1rb nXJ4qexAszwAAI6Tipdw0tk5IEjRJpbDTMSrYABc4WkHESmcmh60BAgjau0OPGhhb2c/ jki7dy+B/KWcI8p2cURLjOyiYrJVJtqZe215dXLRMZWSQz8ktA2l1c+X2ALVuaEod/3M Y93Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ehYpUKTFI5UExZIAe2uu6clvW9afPkllZjxUxYmCAf8=; b=S4C5B9SAmYNkcpFkDHmF+pTFJDxQcF7cdMCxiqKGIngf9b2rNbxhdkW773fyz+UEHr 1/6KvJeincxRA1fY5zpcs9hpgbF4wBxG8kcjoDf3ZIT9Jl5a/bumDTUEuI66RkYDa4ZW /sot/MJ8ny3PE8QHBx0TzxlBebk0a7BM87tRid3r9Ff+R4FU8GPpwj5EBDg30WeUszME t5M6BSD9m1AdbjRqERFxC79CPnFUbtQ4iRY1r88rQlJPXQ2NjmbTx8J4nxNkVKHccQvv ywfaq51wmbkTiKgDcI8lvqJRc9y+6Je7P80iFtQcFvM68TXhAiW/zMLr8mL1bhzvY+gM 6khQ== X-Gm-Message-State: ALKqPwdEWYCjVtUvX9nwupoRTMG8N2TCjU+MiWMvkzjePk5kATuKzWp9 CIJ/VCnzhT/x/5Ae51lYlPDPVw== X-Received: by 2002:a6b:6b02:: with SMTP id g2-v6mr11969958ioc.250.1527874257014; Fri, 01 Jun 2018 10:30:57 -0700 (PDT) Received: from [192.168.1.167] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id t68-v6sm1401596iof.36.2018.06.01.10.30.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 10:30:55 -0700 (PDT) Subject: Re: [PATCH] block: Add block level changes for inline encryption To: Ladvine D Almeida , "ming.lei@redhat.com" Cc: "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Manjunath M Bettegowda , Prabu Thangamuthu , Tejas Joglekar , Joao Pinto References: <77544032-b6ff-bc5e-9fec-666e66b2cc70@kernel.dk> <3fc7786c-af85-d047-047f-44d4eded6124@kernel.dk> From: Jens Axboe Message-ID: Date: Fri, 1 Jun 2018 11:30:54 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/1/18 12:27 AM, Ladvine D Almeida wrote: > On Thursday 31 May 2018 04:46 PM, Jens Axboe wrote: >> On 5/31/18 1:47 AM, Ladvine D Almeida wrote: >>> On Monday 28 May 2018 04:54 PM, Jens Axboe wrote: >>>> On 5/28/18 7:43 AM, Ladvine D Almeida wrote: >>>>> This patch introduces new variable under bio structure to >>>>> facilitate inline encryption. This variable is used to >>>>> associate I/O requests to crypto information. >>>> Hard no on this, for two reasons: >>>> >>>> 1) Any additions to struct bio are scrutinized heavily and >>>> need strong justification. >>> Thanks for sharing your feedback on the patch. >>> I am providing reference to an earlier article related to inline encryption support below: >>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lwn.net_Articles_717754_&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=z00zRD9ARrwHpe-XSl1OtUp1uNKGYoXI1G2DhOaDDBI&m=m8U0bg9QiswO2oVJgJKq3MmJpqPPK_tN667XwsjojcM&s=9VPcl80YTKwbf8T-oCxWTRahYzS2xNDHZMexpFbuepY&e= >> Took a quick look, and this looks like a classic case of something >> that should just be a cloned bio. If you clone, you own the bi_private >> field, which is what you need. > > Cloning the bio gives ownership of the bi_private variable which i can > use to refer to the crypto context. But i have the following problem > here: > 1. In the dm-crypt subsystem, we clone the bio and assign the > bi_private variable. Afterwards, generic_make_request() is done to > submit I/O request to block device. > 2. The bio will be cloned further in the below layers. The reference > in the bi_private variable is now lost as the bio_clone function will > not copy the bi_private variable. > > Also, the bi_private variable is already used in the dm-crypt layer > for storing its private data. This prevents me from using the same. If you clone or allocate a bio, you are the owner of bi_private. If someone further down the stack clones it again, then they own the NEW bi_private of the newly returned cloned. Nobody will mess with yours, that would be a layering violation. That is the way to store data on a per bio basis, not by adding a new random field to the bio structure. -- Jens Axboe