mds: set fscrypt flag on create if xattr buffer has an encryption context

If the client sends an inode with a crypto context already in the xattr
buffer, ensure that we set the fscrypt flag in the inode.

Fixes: https://tracker.ceph.com/issues/50305
Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
Jeff Layton 2021-04-12 15:28:20 -04:00
parent ca822b9a8d
commit 3b1bf45d62

View File

@ -3327,6 +3327,9 @@ CInode* Server::prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino
auto _xattrs = CInode::allocate_xattr_map();
decode_noshare(*_xattrs, p);
dout(10) << "prepare_new_inode setting xattrs " << *_xattrs << dendl;
if (_xattrs->count("encryption.ctx")) {
_inode->fscrypt = true;
}
in->reset_xattrs(std::move(_xattrs));
}