Message ID | 20220318042941.329752-1-xiubli@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ceph: inherit exactly the encryption info from parent for subdirs | expand |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 7b670e2405c1..f005213fe48b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -91,9 +91,15 @@ struct inode *ceph_new_inode(struct inode *dir, struct dentry *dentry, if (err < 0) goto out_err; - err = ceph_fscrypt_prepare_context(dir, inode, as_ctx); - if (err) - goto out_err; + /* + * For subdirs they will inherit the whole encrytion info + * from their parent. + */ + if (!S_ISDIR(*mode)) { + err = ceph_fscrypt_prepare_context(dir, inode, as_ctx); + if (err) + goto out_err; + } return inode; out_err: