Linux FSCRYPT development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: Eric Biggers <ebiggers@kernel.org>
Subject: fscrypt, i_blkbits and network filesystems
Date: Thu, 08 Oct 2020 08:25:10 -0400	[thread overview]
Message-ID: <24943af8b2ede65d5ff1c8ff78c7a00b914e1a20.camel@kernel.org> (raw)

I've had to table the work on fscrypt+ceph for a bit to take care of
some other issues, but I'm hoping to return to it soon, and I've started
looking at the content encryption in more detail.

One thing I'm not sure how to handle yet is fscrypt's reliance on
inode->i_blkbits. For ceph (and most netfs's), this value is a fiction.
We're not constrained to reading/writing along block boundaries.

Cephfs usually sets the blocksize in a S_ISREG inode to the same as a
"chunk" on the OSD (usu. 4M). That's a bit too large to deal with IMO,
so I'm looking at lowering that to PAGE_SIZE when fscrypt is enabled.

That's reasonable when we can do pagecache-based I/O, but sometimes
netfs's will do I/O directly from read_iter/write_iter. For ceph, we may
need to do a rmw cycle if the iovec passed down from userland doesn't
align to crypto block boundaries. Ceph has a way to do a cmp_extent
operation such that it will only do the write if nothing changed in the
interim, so we can handle that case, but it would be better not to have
to read/write more than we need.

For the netfs case, would we be better off avoiding routines that take
i_blkbits into account, and instead just work with
fscrypt_encrypt_block_inplace / fscrypt_decrypt_block_inplace, maybe
even by rolling new helpers that call them under the hood? Or, would
that cause issues that I haven't forseen, and I should just stick to
PAGE_SIZE blocks?

Thoughts?
-- 
Jeff Layton <jlayton@kernel.org>


             reply	other threads:[~2020-10-08 12:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 12:25 Jeff Layton [this message]
2020-10-08 17:46 ` fscrypt, i_blkbits and network filesystems Eric Biggers
2020-10-09 20:16   ` Jeff Layton
2020-10-09 21:50     ` Eric Biggers

Reply instructions:

You may reply publicly 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=24943af8b2ede65d5ff1c8ff78c7a00b914e1a20.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ebiggers@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox