#include <lustre_acl.h>
#include <lustre_compat.h>
-#include <lustre_eacl.h>
#include <md_object.h>
#include <dt_object.h>
#include <lustre_lfsck.h>
int __mdd_fix_mode_acl(const struct lu_env *env, struct lu_buf *buf,
__u32 *mode);
int __mdd_permission_internal(const struct lu_env *env, struct mdd_object *obj,
- const struct lu_attr *la, int mask, int role);
+ const struct lu_attr *la, unsigned int may_mask,
+ int role);
int mdd_permission(const struct lu_env *env, struct md_object *pobj,
- struct md_object *cobj, struct md_attr *ma, int mask);
+ struct md_object *cobj, struct md_attr *ma,
+ unsigned int may_mask);
int mdd_generic_thread_start(struct mdd_generic_thread *thread,
int (*func)(void *), void *data, char *name);
void mdd_generic_thread_stop(struct mdd_generic_thread *thread);
/* mdd_prepare.c */
int mdd_compat_fixes(const struct lu_env *env, struct mdd_device *mdd);
+/* acl.c */
+extern int lustre_posix_acl_permission(struct lu_ucred *mu,
+ const struct lu_attr *la,
+ unsigned int may_mask,
+ posix_acl_xattr_entry *entry,
+ int count);
+extern int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry,
+ __u32 mode, int count);
+extern int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry,
+ __u32 *pmode, int count);
+extern int lustre_posix_acl_equiv_mode(posix_acl_xattr_entry *entry,
+ mode_t *mode_p, int count);
+
/* inline functions */
static inline int lu_device_is_mdd(struct lu_device *d)
{
static inline int mdd_permission_internal(const struct lu_env *env,
struct mdd_object *obj,
- const struct lu_attr *la, int mask)
+ const struct lu_attr *la,
+ unsigned int may_mask)
{
- return __mdd_permission_internal(env, obj, la, mask, -1);
+ return __mdd_permission_internal(env, obj, la, may_mask, -1);
}
static inline int mdd_permission_internal_locked(const struct lu_env *env,
struct mdd_object *obj,
const struct lu_attr *la,
- int mask,
+ unsigned int may_mask,
enum dt_object_role role)
{
- return __mdd_permission_internal(env, obj, la, mask, role);
+ return __mdd_permission_internal(env, obj, la, may_mask, role);
}
/* mdd inline func for calling osd_dt_object ops */
if (!mdd_object_exists(obj))
return -ENOENT;
+ /* If we are about to set the LL_XATTR_NAME_ENCRYPTION_CONTEXT
+ * xattr, it means the file/dir is encrypted. In that case we want
+ * to set the LUSTRE_ENCRYPT_FL flag as well: it will be stored
+ * into the LMA, making it more efficient to recognise we are
+ * dealing with an encrypted file/dir, as LMA info is cached upon
+ * object init.
+ * However, marking a dir as encrypted is only possible if it is
+ * being created or migrated (LU_XATTR_CREATE flag not set), or
+ * if it is empty.
+ */
if ((strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT) == 0) &&
(!S_ISDIR(mdd_object_type(obj)) ||
+ !(fl & LU_XATTR_CREATE) ||
(rc = mdd_dir_is_empty(env, obj)) == 0)) {
struct lu_attr la = { 0 };