]> 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)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 15 Aug 2022 12:51:41 +0000 (14:51 +0200)
commit48228ec82f9d9ee577fdf41edce8ecb9be871f87
tree63386a708d65465fa8cd0a2c0f558a1755ef2276
parent0637c29d3f4a9ae774e3d345141ef4e91c8b14c2
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