]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: set fscrypt flag on create if xattr buffer has an encryption context
authorJeff Layton <jlayton@redhat.com>
Mon, 12 Apr 2021 19:28:20 +0000 (15:28 -0400)
committerJeff Layton <jlayton@redhat.com>
Tue, 13 Apr 2021 13:53:11 +0000 (09:53 -0400)
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>
src/mds/Server.cc

index ef12a4c9a992bbbaef2a20a9c099fb71c6506d65..3c61d6bb9e418022d6132b1cba0b00894459ce1b 100644 (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));
   }