]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
fscrypt: add fscrypt_context_for_new_inode
authorJeff Layton <jlayton@kernel.org>
Tue, 1 Sep 2020 16:56:42 +0000 (12:56 -0400)
committerJeff Layton <jlayton@kernel.org>
Tue, 31 May 2022 14:42:44 +0000 (10:42 -0400)
commitb24d20af4c2e131c9d9696823fe0baf3fc249d57
treed11120ae97ae31af2a18eafc0498eebbe0b04a5a
parent3d8818a3c3ceb63897a86fd1f30e9f13554e2a3a
fscrypt: add fscrypt_context_for_new_inode

Most filesystems just call fscrypt_set_context on new inodes, which
usually causes a setxattr. That's a bit late for ceph, which can send
along a full set of attributes with the create request.

Doing so allows it to avoid race windows that where the new inode could
be seen by other clients without the crypto context attached. It also
avoids the separate round trip to the server.

Refactor the fscrypt code a bit to allow us to create a new crypto
context, attach it to the inode, and write it to the buffer, but without
calling set_context on it. ceph can later use this to marshal the
context into the attributes we send along with the create request.

Acked-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/crypto/policy.c
include/linux/fscrypt.h