ceph: add support to readdir for encrypted names
authorXiubo Li <xiubli@redhat.com>
Mon, 14 Mar 2022 02:28:35 +0000 (10:28 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 24 Aug 2023 09:24:34 +0000 (11:24 +0200)
commitaf9ffa6df7e337599ce41165d9e6166a330c7b96
treee62445c27ebbdba422319064f1ff141ca03b82ea
parent3859af9eba958cec91e4908f64787f190254f565
ceph: add support to readdir for encrypted names

To make it simpler to decrypt names in a readdir reply (i.e. before
we have a dentry), add a new ceph_encode_encrypted_fname()-like helper
that takes a qstr pointer instead of a dentry pointer.

Once we've decrypted the names in a readdir reply, we no longer need the
crypttext, so overwrite them in ceph_mds_reply_dir_entry with the
unencrypted names. Then in both ceph_readdir_prepopulate() and
ceph_readdir() we will use the dencrypted name directly.

[ jlayton: convert some BUG_ONs into error returns ]

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/crypto.c
fs/ceph/crypto.h
fs/ceph/dir.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h