From 3b1bf45d62557c74b756b10941ce086076fd2d7e Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 12 Apr 2021 15:28:20 -0400 Subject: [PATCH] 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 --- src/mds/Server.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index ef12a4c9a992..3c61d6bb9e41 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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)); } -- 2.47.3