X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnodemap_lproc.c;h=253952281de31cac9870d620b2bc685b42aadbb8;hp=62a053f9c3e0d9053e7b07db93acee537e408780;hb=f55fdfff5dede69e6674999fb02c1add513704f0;hpb=6c6ca1fbfb1b2be0e6a9675f9214f98e59bc8088 diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c index 62a053f..2539522 100644 --- a/lustre/ptlrpc/nodemap_lproc.c +++ b/lustre/ptlrpc/nodemap_lproc.c @@ -118,7 +118,6 @@ static int nodemap_ranges_show(struct seq_file *m, void *data) { struct lu_nodemap *nodemap; struct lu_nid_range *range; - struct interval_node_extent ext; char start_nidstr[LNET_NIDSTR_SIZE]; char end_nidstr[LNET_NIDSTR_SIZE]; bool cont = false; @@ -140,9 +139,8 @@ static int nodemap_ranges_show(struct seq_file *m, void *data) if (cont) seq_printf(m, ",\n"); cont = 1; - ext = range->rn_node.in_extent; - libcfs_nid2str_r(ext.start, start_nidstr, sizeof(start_nidstr)); - libcfs_nid2str_r(ext.end, end_nidstr, sizeof(end_nidstr)); + libcfs_nid2str_r(range->rn_start, start_nidstr, sizeof(start_nidstr)); + libcfs_nid2str_r(range->rn_end, end_nidstr, sizeof(end_nidstr)); seq_printf(m, " { id: %u, start_nid: %s, end_nid: %s }", range->rn_id, start_nidstr, end_nidstr); } @@ -637,6 +635,33 @@ static int nodemap_audit_mode_seq_show(struct seq_file *m, void *data) return 0; } +/** + * Reads and prints the forbid_encryption flag for the given nodemap. + * + * \param m seq file in proc fs + * \param data unused + * \retval 0 success + */ +static int nodemap_forbid_encryption_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_forbid_encryption); + nodemap_putref(nodemap); + return 0; +} + static struct lprocfs_vars lprocfs_nm_module_vars[] = { { .name = "active", @@ -655,22 +680,23 @@ LPROC_SEQ_FOPS_RO(nodemap_squash_gid); LPROC_SEQ_FOPS_RO(nodemap_deny_unknown); LPROC_SEQ_FOPS_RO(nodemap_map_mode); LPROC_SEQ_FOPS_RO(nodemap_audit_mode); +LPROC_SEQ_FOPS_RO(nodemap_forbid_encryption); -const struct file_operations nodemap_ranges_fops = { +static const struct file_operations nodemap_ranges_fops = { .open = nodemap_ranges_open, .read = seq_read, .llseek = seq_lseek, .release = single_release }; -const struct file_operations nodemap_idmap_fops = { +static const struct file_operations nodemap_idmap_fops = { .open = nodemap_idmap_open, .read = seq_read, .llseek = seq_lseek, .release = single_release }; -const struct file_operations nodemap_exports_fops = { +static const struct file_operations nodemap_exports_fops = { .open = nodemap_exports_open, .read = seq_read, .llseek = seq_lseek, @@ -703,6 +729,10 @@ static struct lprocfs_vars lprocfs_nodemap_vars[] = { .fops = &nodemap_audit_mode_fops, }, { + .name = "forbid_encryption", + .fops = &nodemap_forbid_encryption_fops, + }, + { .name = "squash_uid", .fops = &nodemap_squash_uid_fops, }, @@ -773,6 +803,10 @@ static struct lprocfs_vars lprocfs_default_nodemap_vars[] = { .fops = &nodemap_audit_mode_fops, }, { + .name = "forbid_encryption", + .fops = &nodemap_forbid_encryption_fops, + }, + { NULL } };