/*
* Copyright (C) 2013, Trustees of Indiana University
*
- * Copyright (c) 2014, 2015, Intel Corporation.
+ * Copyright (c) 2014, 2017, Intel Corporation.
*
* Author: Joshua Walgenbach <jjw@iu.edu>
*/
}
seq_printf(m, "[\n");
- read_lock(&nodemap->nm_idmap_lock);
+ down_read(&nodemap->nm_idmap_lock);
for (node = rb_first(&nodemap->nm_client_to_fs_uidmap); node;
node = rb_next(node)) {
if (cont)
"fs_id: %u }", idmap->id_client,
idmap->id_fs);
}
- read_unlock(&nodemap->nm_idmap_lock);
+ up_read(&nodemap->nm_idmap_lock);
seq_printf(m, "\n");
seq_printf(m, "]\n");
return 0;
}
+/**
+ * Reads and prints the audit_mode flag for the given nodemap.
+ *
+ * \param m seq file in proc fs
+ * \param data unused
+ * \retval 0 success
+ */
+static int nodemap_audit_mode_seq_show(struct seq_file *m, void *data)
+{
+ struct lu_nodemap *nodemap;
+ int rc;
+
+ mutex_lock(&active_config_lock);
+ nodemap = nodemap_lookup(m->private);
+ mutex_unlock(&active_config_lock);
+ if (IS_ERR(nodemap)) {
+ rc = PTR_ERR(nodemap);
+ CERROR("cannot find nodemap '%s': rc = %d\n",
+ (char *)m->private, rc);
+ return rc;
+ }
+
+ seq_printf(m, "%d\n", (int)nodemap->nmf_enable_audit);
+ nodemap_putref(nodemap);
+ return 0;
+}
+
#ifdef NODEMAP_PROC_DEBUG
/**
* Helper functions to set nodemap flags.
&nidlist) <= 0)
return -EINVAL;
- if (!cfs_nidrange_is_contiguous(&nidlist))
- return -EINVAL;
+ rc = cfs_nidrange_find_min_max(&nidlist, nidstr[0], nidstr[1],
+ LNET_NIDSTR_SIZE);
+ if (rc < 0)
+ return rc;
- cfs_nidrange_find_min_max(&nidlist, nidstr[0], nidstr[1],
- LNET_NIDSTR_SIZE);
snprintf(nidrange_str, sizeof(nidrange_str), "%s:%s",
nidstr[0], nidstr[1]);
LPROC_SEQ_FOPS_RO(nodemap_deny_unknown);
LPROC_SEQ_FOPS_RO(nodemap_map_mode);
+LPROC_SEQ_FOPS_RO(nodemap_audit_mode);
const struct file_operations nodemap_ranges_fops = {
.open = nodemap_ranges_open,
.fops = &nodemap_map_mode_fops,
},
{
+ .name = "audit_mode",
+ .fops = &nodemap_audit_mode_fops,
+ },
+ {
.name = "squash_uid",
.fops = &nodemap_squash_uid_fops,
},
.fops = &nodemap_exports_fops,
},
{
+ .name = "audit_mode",
+ .fops = &nodemap_audit_mode_fops,
+ },
+ {
NULL
}
};