Linux-FSCrypt Archive on lore.kernel.org
 help / color / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-ext4@vger.kernel.org, linux-fscrypt@vger.kernel.org
Subject: Re: [PATCH] ext4: allow ZERO_RANGE on encrypted files
Date: Mon, 13 Jan 2020 14:29:51 -0500
Message-ID: <20200113192951.GA76141@mit.edu> (raw)
In-Reply-To: <20191226154216.4808-1-ebiggers@kernel.org>

On Thu, Dec 26, 2019 at 09:42:16AM -0600, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> When ext4 encryption support was first added, ZERO_RANGE was disallowed,
> supposedly because test failures (e.g. ext4/001) were seen when enabling
> it, and at the time there wasn't enough time/interest to debug it.
> 
> However, there's actually no reason why ZERO_RANGE can't work on
> encrypted files.  And it fact it *does* work now.  Whole blocks in the
> zeroed range are converted to unwritten extents, as usual; encryption
> makes no difference for that part.  Partial blocks are zeroed in the
> pagecache and then ->writepages() encrypts those blocks as usual.
> ext4_block_zero_page_range() handles reading and decrypting the block if
> needed before actually doing the pagecache write.
> 
> Also, f2fs has always supported ZERO_RANGE on encrypted files.
> 
> As far as I can tell, the reason that ext4/001 was failing in v4.1 was
> actually because of one of the bugs fixed by commit 36086d43f657 ("ext4
> crypto: fix bugs in ext4_encrypted_zeroout()").  The bug made
> ext4_encrypted_zeroout() always return a positive value, which caused
> unwritten extents in encrypted files to sometimes not be marked as
> initialized after being written to.  This bug was not actually in
> ZERO_RANGE; it just happened to trigger during the extents manipulation
> done in ext4/001 (and probably other tests too).
> 
> So, let's enable ZERO_RANGE on encrypted files on ext4.
> 
> Tested with:
> 	gce-xfstests -c ext4/encrypt -g auto
> 	gce-xfstests -c ext4/encrypt_1k -g auto
> 
> Got the same set of test failures both with and without this patch.
> But with this patch 6 fewer tests are skipped: ext4/001, generic/008,
> generic/009, generic/033, generic/096, and generic/511.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

					- Ted

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 15:42 Eric Biggers
2020-01-13 19:29 ` Theodore Y. Ts'o [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200113192951.GA76141@mit.edu \
    --to=tytso@mit.edu \
    --cc=ebiggers@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-FSCrypt Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fscrypt/0 linux-fscrypt/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fscrypt linux-fscrypt/ https://lore.kernel.org/linux-fscrypt \
		linux-fscrypt@vger.kernel.org
	public-inbox-index linux-fscrypt

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fscrypt


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git