Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp608394pxb; Thu, 21 Jan 2021 15:26:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1lekvnla5z+6+HzDDvHb9RBsxGvxc4fGb7P9819Fr4eEQnAGR+GC1g/H5nQ1k52w/qLnf X-Received: by 2002:a05:6402:50c6:: with SMTP id h6mr1134239edb.117.1611271578329; Thu, 21 Jan 2021 15:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611271578; cv=none; d=google.com; s=arc-20160816; b=oZZOH0TxP+Sp/o25cQ88+HBJLvZJ71T4Cp1pAF+3P6x/deAPI19YhJY1EASmRdiXIb xzjNFaXQcOCH2wdGEsbrvfYzkv8L9dN6Ce+drVLzypsX4qcnFHOHCCpKUb42/jtUen96 0EB8PrYqQGDwldywwFxEbuHoGGoNi2aC7hltBLyBHsyJCd8l4ifVFWTeiqhf2PCjJLNG PEEBlXQaV229fPRTIKyRw5y3xPv0B9d4MbKY1CRnJqdjHvskRp9RVZWdRshtdcVIuUre id8fWEvlbAmfPmCw5sVat+Ltq7YyU6pDCwP0uyeqZ7mSTDdaBSk735kpYdg+ecE4d7/j VQ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=CZMyGWlKFZQTRektdrF/slvssAIzMQGtBohXi2xlJZo=; b=kLJDzgcxktQy6GoDkQ1kevY6Tpot718+lgXvrMQFSUrfiQvlbnJ5HQAtlLLMEoFCzH WCb822cdonX/zhNzaBYK7SNVjEOFmacTcncXJwYnkq14En4l1D8vTCRhxJGdryz101XI Qcpt5uvBLek53Tp2p8XYUvmra3fxQ5+TwQGsE0xr1v6/P4fn797dlET8T4H3c8CrDLhp 6CGWoqu0BtRJJVgx3RcJQ87yg2MG7IYZwIMCAvxNsXiCd/8tOccSl3rV6UjEUEbPV2ed Ao6D8RKR5W6a18/2rOiidrodXp251QQpQNZNmjD7c/xldAT1My86mo9M6xYkkVPscm7F MKxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rrCQEqKV; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si2315353ejc.6.2021.01.21.15.25.53; Thu, 21 Jan 2021 15:26:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@google.com header.s=20161025 header.b=rrCQEqKV; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbhAUXXn (ORCPT + 99 others); Thu, 21 Jan 2021 18:23:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbhAUXGb (ORCPT ); Thu, 21 Jan 2021 18:06:31 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30043C061A10 for ; Thu, 21 Jan 2021 15:03:55 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 9so3682889ybj.16 for ; Thu, 21 Jan 2021 15:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=CZMyGWlKFZQTRektdrF/slvssAIzMQGtBohXi2xlJZo=; b=rrCQEqKVW1ZDhW4+xC0fjbzkbeY/JM71fiwBKXHsmFH4bwE2GxtDFk+U88/SUhdZrf m7wzzh7s3pqKnNjd10foCZJDNdK/vkuuRpPD69ujIVZe3eifyns8biUA8hZoFwPNKnDb Ba3v3G79vllZnXC34ggan7U2sUksnH545H+f+6bih9NuBbW12SjTSwsWplttdtVyg536 GP0pN9LaqdE82PHlByUSvgve2pSMZuoQ6XfZu6yXARBBw+19h3asuK13j5tmK1ncQkcY r6k+aHDCwUHG8X/Lo9Rh9plI3yOEJxIzYYGPgdsvlhvIGQPysaEunA99fEdDpORoP0Ww T1lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=CZMyGWlKFZQTRektdrF/slvssAIzMQGtBohXi2xlJZo=; b=Wgh11Otr0dEqjDNiPkVH/6CT/7z/hZvfTz/74cHfyoiycUz7JtPtkdUKBJynUr7oTb G47f64X7UkZ9vSOMjnYaH6tLDQFJ3pDDaMIaC2qDCnPinV/9RLQ03v4mylqACpe+jIqA ZLhOOvSib6DExAcwpjhNJzGZkQWJyfPnl1PqRVYrU9Ww5n7R46LsdPem9gNsK6jw3jKT doaCdECfrkjt+oI2g4GuRSfzDbY/wn/Hd2spK6N4QrqcCDLQ3kD+YOUgbhm35bdcKH11 c6cHUD/dbIyL0EO9/pMwDroOLg3Hfs7vCgcFUiWeTbjaMIjREAX1mq67hGEY5wKK5yct LKCQ== X-Gm-Message-State: AOAM531EE8zJ3vY2jFUyaVLdOmzPdUOaRbl+uT0Qpe9//5z6W3VWQHOK KHGgOnYIbD5otSFhQifBOuukxrdWml8= Sender: "satyat via sendgmr" X-Received: from satyaprateek.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:1092]) (user=satyat job=sendgmr) by 2002:a25:61c2:: with SMTP id v185mr2563181ybb.378.1611270234438; Thu, 21 Jan 2021 15:03:54 -0800 (PST) Date: Thu, 21 Jan 2021 23:03:36 +0000 In-Reply-To: <20210121230336.1373726-1-satyat@google.com> Message-Id: <20210121230336.1373726-9-satyat@google.com> Mime-Version: 1.0 References: <20210121230336.1373726-1-satyat@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v8 8/8] fscrypt: update documentation for direct I/O support From: Satya Tangirala To: "Theodore Y . Ts'o" , Jaegeuk Kim , Eric Biggers , Chao Yu , Jens Axboe , "Darrick J . Wong" Cc: linux-kernel@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, Satya Tangirala , Eric Biggers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Update fscrypt documentation to reflect the addition of direct I/O support and document the necessary conditions for direct I/O on encrypted files. Signed-off-by: Satya Tangirala Reviewed-by: Eric Biggers Reviewed-by: Jaegeuk Kim --- Documentation/filesystems/fscrypt.rst | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst index 44b67ebd6e40..c0c1747fa2fb 100644 --- a/Documentation/filesystems/fscrypt.rst +++ b/Documentation/filesystems/fscrypt.rst @@ -1047,8 +1047,10 @@ astute users may notice some differences in behavior: may be used to overwrite the source files but isn't guaranteed to be effective on all filesystems and storage devices. -- Direct I/O is not supported on encrypted files. Attempts to use - direct I/O on such files will fall back to buffered I/O. +- Direct I/O is supported on encrypted files only under some + circumstances (see `Direct I/O support`_ for details). When these + circumstances are not met, attempts to use direct I/O on encrypted + files will fall back to buffered I/O. - The fallocate operations FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_INSERT_RANGE are not supported on encrypted files and will @@ -1121,6 +1123,21 @@ It is not currently possible to backup and restore encrypted files without the encryption key. This would require special APIs which have not yet been implemented. +Direct I/O support +================== + +Direct I/O on encrypted files is supported through blk-crypto. In +particular, this means the kernel must have CONFIG_BLK_INLINE_ENCRYPTION +enabled, the filesystem must have had the 'inlinecrypt' mount option +specified, and either hardware inline encryption must be present, or +CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK must have been enabled. Further, +the starting position in the file and the length of any I/O must be aligned +to the filesystem block size (*not* necessarily the same as the block +device's block size). If any of these conditions isn't met, attempts to do +direct I/O on an encrypted file will fall back to buffered I/O. However, +there aren't any additional requirements on user buffer alignment (apart +from those already present when using direct I/O on unencrypted files). + Encryption policy enforcement ============================= -- 2.30.0.280.ga3ce27912f-goog