]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: preallocate inode for ops that may create one
authorJeff Layton <jlayton@kernel.org>
Wed, 26 Aug 2020 17:11:00 +0000 (13:11 -0400)
committerJeff Layton <jlayton@kernel.org>
Tue, 31 May 2022 14:45:33 +0000 (10:45 -0400)
commitc94a58346bfb86b0042993ca6e3a8880c4e7870d
treefed0240bcaa3647bf94089f4a1df4dad1d03f478
parent64d2fad4bee0a618e7538bb4d86b924073efee77
ceph: preallocate inode for ops that may create one

When creating a new inode, we need to determine the crypto context
before we can transmit the RPC. The fscrypt API has a routine for getting
a crypto context before a create occurs, but it requires an inode.

Change the ceph code to preallocate an inode in advance of a create of
any sort (open(), mknod(), symlink(), etc). Move the existing code that
generates the ACL and SELinux blobs into this routine since that's
mostly common across all the different codepaths.

In most cases, we just want to allow ceph_fill_trace to use that inode
after the reply comes in, so add a new field to the MDS request for it
(r_new_inode).

The async create codepath is a bit different though. In that case, we
want to hash the inode in advance of the RPC so that it can be used
before the reply comes in. If the call subsequently fails with
-EJUKEBOX, then just put the references and clean up the as_ctx. Note
that with this change, we now need to regenerate the as_ctx when this
occurs, but it's quite rare for it to happen.

Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.h