• Jeff Layton's avatar
    ceph: preallocate inode for ops that may create one · ec9595c0
    Jeff Layton authored
    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.
    Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
    Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
    Reviewed-and-tested-by: default avatarLuís Henriques <lhenriques@suse.de>
    Reviewed-by: default avatarMilind Changire <mchangir@redhat.com>
    Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
    ec9595c0
mds_client.h 17.9 KB