X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnodemap_handler.c;h=aa1e5f228603c896281f9127481ab4abe1f8095a;hb=601c48f3ecaefcb644f236344e139088f76a2a07;hp=a30cd9cbb4266d4f91ab392509be3549f19e3fd3;hpb=56203e4ba0a64789e42ea45946e8c51f1db351fb;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nodemap_handler.c b/lustre/ptlrpc/nodemap_handler.c index a30cd9c..aa1e5f2 100644 --- a/lustre/ptlrpc/nodemap_handler.c +++ b/lustre/ptlrpc/nodemap_handler.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "nodemap_internal.h" @@ -745,7 +744,8 @@ ssize_t nodemap_map_acl(struct lu_nodemap *nodemap, void *buf, size_t size, if (count < 0) RETURN(-EINVAL); if (count == 0) - RETURN(0); + /* if not proper ACL, do nothing and return initial size */ + RETURN(size); for (end = entry + count; entry != end; entry++) { __u16 tag = le16_to_cpu(entry->e_tag); @@ -1172,6 +1172,7 @@ struct lu_nodemap *nodemap_create(const char *name, nodemap->nmf_map_uid_only = 0; nodemap->nmf_map_gid_only = 0; nodemap->nmf_enable_audit = 1; + nodemap->nmf_forbid_encryption = 0; nodemap->nm_squash_uid = NODEMAP_NOBODY_UID; nodemap->nm_squash_gid = NODEMAP_NOBODY_GID; @@ -1193,6 +1194,8 @@ struct lu_nodemap *nodemap_create(const char *name, default_nodemap->nmf_map_gid_only; nodemap->nmf_enable_audit = default_nodemap->nmf_enable_audit; + nodemap->nmf_forbid_encryption = + default_nodemap->nmf_forbid_encryption; nodemap->nm_squash_uid = default_nodemap->nm_squash_uid; nodemap->nm_squash_gid = default_nodemap->nm_squash_gid; @@ -1434,6 +1437,34 @@ out: } EXPORT_SYMBOL(nodemap_set_audit_mode); +/** + * Set the nmf_forbid_encryption flag to true or false. + * \param name nodemap name + * \param forbid_encryption if true, forbid encryption + * \retval 0 on success + * + */ +int nodemap_set_forbid_encryption(const char *name, bool forbid_encryption) +{ + struct lu_nodemap *nodemap = NULL; + int rc = 0; + + mutex_lock(&active_config_lock); + nodemap = nodemap_lookup(name); + mutex_unlock(&active_config_lock); + if (IS_ERR(nodemap)) + GOTO(out, rc = PTR_ERR(nodemap)); + + nodemap->nmf_forbid_encryption = forbid_encryption; + rc = nodemap_idx_nodemap_update(nodemap); + + nm_member_revoke_locks(nodemap); + nodemap_putref(nodemap); +out: + return rc; +} +EXPORT_SYMBOL(nodemap_set_forbid_encryption); + /** * Add a nodemap @@ -1591,6 +1622,8 @@ struct nodemap_config *nodemap_config_alloc(void) init_rwsem(&config->nmc_range_tree_lock); + config->nmc_range_tree.nmrt_range_interval_root = INTERVAL_TREE_ROOT; + return config; } EXPORT_SYMBOL(nodemap_config_alloc);