From 339a4e0ed2aaefe156a823dd9cf28eb1536ae9c1 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Tue, 30 Apr 2019 13:27:27 -0400 Subject: [PATCH] LU-8066 ptlrpc: move sptlrpc procfs entry to debugfs We might want eventualy split it into a bunch of single-value sysfs entries, I imagine, but there is no urgent need now. Linux-commit : 77386b3c0b4470db1ed546de858b31cac66fc943 Migrate the GSS stuff to debugfs as well. Test-Parameters: envdefinitions=SHARED_KEY=true testlist=sanity,recovery-small,sanity-sec Change-Id: I417d3a46aa21cd7dca7cb8f7b6fd78623d726bed Signed-off-by: Dmitry Eremin Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/30963 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Petros Koutoupis Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- lustre/include/lustre_sec.h | 7 +----- lustre/ptlrpc/gss/gss_internal.h | 4 ++-- lustre/ptlrpc/gss/lproc_gss.c | 52 +++++++++++++++++++--------------------- lustre/ptlrpc/gss/sec_gss.c | 10 ++++---- lustre/ptlrpc/sec_lproc.c | 29 +++++++++++----------- 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 08f74aa..b7bd9e6 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -965,12 +965,7 @@ struct ptlrpc_bulk_sec_desc { __u8 bsd_data[0]; /* policy-specific token */ }; - -/* - * lprocfs - */ -struct proc_dir_entry; -extern struct proc_dir_entry *sptlrpc_proc_root; +extern struct dentry *sptlrpc_debugfs_dir; /* * round size up to next power of 2, for slab allocation. diff --git a/lustre/ptlrpc/gss/gss_internal.h b/lustre/ptlrpc/gss/gss_internal.h index f0b9d28..bf7966c 100644 --- a/lustre/ptlrpc/gss/gss_internal.h +++ b/lustre/ptlrpc/gss/gss_internal.h @@ -514,8 +514,8 @@ void gss_exit_svc_upcall(void); void gss_stat_oos_record_cli(int behind); void gss_stat_oos_record_svc(int phase, int replay); -int __init gss_init_lproc(void); -void gss_exit_lproc(void); +int __init gss_init_tunables(void); +void gss_exit_tunables(void); /* gss_null_mech.c */ int __init init_null_module(void); diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index b5403ad..15e48b3 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -50,8 +50,8 @@ #include "gss_internal.h" #include "gss_api.h" -static struct proc_dir_entry *gss_proc_root = NULL; -static struct proc_dir_entry *gss_proc_lk = NULL; +static struct dentry *gss_debugfs_dir_lk; +static struct dentry *gss_debugfs_dir; /* * statistic of "out-of-sequence-window" @@ -112,7 +112,7 @@ static int gss_proc_oos_seq_show(struct seq_file *m, void *v) atomic_read(&gss_stat_oos.oos_svc_pass[2])); return 0; } -LPROC_SEQ_FOPS_RO(gss_proc_oos); +LDEBUGFS_SEQ_FOPS_RO(gss_proc_oos); static ssize_t gss_proc_write_secinit(struct file *file, const char *buffer, @@ -132,7 +132,7 @@ static const struct file_operations gss_proc_secinit = { .write = gss_proc_write_secinit, }; -static struct lprocfs_vars gss_lprocfs_vars[] = { +static struct lprocfs_vars gss_debugfs_vars[] = { { .name = "replays", .fops = &gss_proc_oos_fops }, { .name = "init_channel", @@ -172,46 +172,43 @@ gss_lk_proc_dl_seq_write(struct file *file, const char __user *buffer, return count; } -LPROC_SEQ_FOPS(gss_lk_proc_dl); +LDEBUGFS_SEQ_FOPS(gss_lk_proc_dl); -static struct lprocfs_vars gss_lk_lprocfs_vars[] = { +static struct lprocfs_vars gss_lk_debugfs_vars[] = { { .name = "debug_level", .fops = &gss_lk_proc_dl_fops }, { NULL } }; -void gss_exit_lproc(void) +void gss_exit_tunables(void) { - if (gss_proc_lk) { - lprocfs_remove(&gss_proc_lk); - gss_proc_lk = NULL; - } + if (!IS_ERR_OR_NULL(gss_debugfs_dir_lk)) + ldebugfs_remove(&gss_debugfs_dir_lk); - if (gss_proc_root) { - lprocfs_remove(&gss_proc_root); - gss_proc_root = NULL; - } + if (!IS_ERR_OR_NULL(gss_debugfs_dir)) + ldebugfs_remove(&gss_debugfs_dir); } -int gss_init_lproc(void) +int gss_init_tunables(void) { int rc; spin_lock_init(&gss_stat_oos.oos_lock); - gss_proc_root = lprocfs_register("gss", sptlrpc_proc_root, - gss_lprocfs_vars, NULL); - if (IS_ERR(gss_proc_root)) { - rc = PTR_ERR(gss_proc_root); - gss_proc_root = NULL; + gss_debugfs_dir = ldebugfs_register("gss", sptlrpc_debugfs_dir, + gss_debugfs_vars, NULL); + if (IS_ERR_OR_NULL(gss_debugfs_dir)) { + rc = gss_debugfs_dir ? PTR_ERR(gss_debugfs_dir) : -ENOMEM; + gss_debugfs_dir = NULL; GOTO(out, rc); } - gss_proc_lk = lprocfs_register("lgss_keyring", gss_proc_root, - gss_lk_lprocfs_vars, NULL); - if (IS_ERR(gss_proc_lk)) { - rc = PTR_ERR(gss_proc_lk); - gss_proc_lk = NULL; + gss_debugfs_dir_lk = ldebugfs_register("lgss_keyring", gss_debugfs_dir, + gss_lk_debugfs_vars, NULL); + if (IS_ERR(gss_debugfs_dir_lk)) { + rc = gss_debugfs_dir_lk ? PTR_ERR(gss_debugfs_dir_lk) + : -ENOMEM; + gss_debugfs_dir_lk = NULL; GOTO(out, rc); } @@ -219,7 +216,6 @@ int gss_init_lproc(void) out: CERROR("failed to initialize gss lproc entries: %d\n", rc); - gss_exit_lproc(); - + gss_exit_tunables(); return rc; } diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index ab59c84..8ca6e2f 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -2854,13 +2854,13 @@ static int __init sptlrpc_gss_init(void) { int rc; - rc = gss_init_lproc(); + rc = gss_init_tunables(); if (rc) return rc; rc = gss_init_cli_upcall(); if (rc) - goto out_lproc; + goto out_tunables; rc = gss_init_svc_upcall(); if (rc) @@ -2905,8 +2905,8 @@ out_svc_upcall: gss_exit_svc_upcall(); out_cli_upcall: gss_exit_cli_upcall(); -out_lproc: - gss_exit_lproc(); +out_tunables: + gss_exit_tunables(); return rc; } @@ -2917,7 +2917,7 @@ static void __exit sptlrpc_gss_exit(void) cleanup_kerberos_module(); gss_exit_svc_upcall(); gss_exit_cli_upcall(); - gss_exit_lproc(); + gss_exit_tunables(); } MODULE_AUTHOR("OpenSFS, Inc. "); diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c index 37bca07..2ba29c4 100644 --- a/lustre/ptlrpc/sec_lproc.c +++ b/lustre/ptlrpc/sec_lproc.c @@ -49,10 +49,6 @@ #include "ptlrpc_internal.h" - -struct proc_dir_entry *sptlrpc_proc_root = NULL; -EXPORT_SYMBOL(sptlrpc_proc_root); - static char *sec_flags2str(unsigned long flags, char *buf, int bufsize) { buf[0] = '\0'; @@ -251,24 +247,29 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev) } EXPORT_SYMBOL(sptlrpc_lprocfs_cliobd_attach); -LPROC_SEQ_FOPS_RO(sptlrpc_proc_enc_pool); +LDEBUGFS_SEQ_FOPS_RO(sptlrpc_proc_enc_pool); + static struct lprocfs_vars sptlrpc_lprocfs_vars[] = { { .name = "encrypt_page_pools", .fops = &sptlrpc_proc_enc_pool_fops }, { NULL } }; +struct dentry *sptlrpc_debugfs_dir; +EXPORT_SYMBOL(sptlrpc_debugfs_dir); + int sptlrpc_lproc_init(void) { int rc; - LASSERT(sptlrpc_proc_root == NULL); + LASSERT(sptlrpc_debugfs_dir == NULL); - sptlrpc_proc_root = lprocfs_register("sptlrpc", proc_lustre_root, - sptlrpc_lprocfs_vars, NULL); - if (IS_ERR(sptlrpc_proc_root)) { - rc = PTR_ERR(sptlrpc_proc_root); - sptlrpc_proc_root = NULL; + sptlrpc_debugfs_dir = ldebugfs_register("sptlrpc", debugfs_lustre_root, + sptlrpc_lprocfs_vars, NULL); + if (IS_ERR_OR_NULL(sptlrpc_debugfs_dir)) { + rc = sptlrpc_debugfs_dir ? PTR_ERR(sptlrpc_debugfs_dir) + : -ENOMEM; + sptlrpc_debugfs_dir = NULL; return rc; } return 0; @@ -276,8 +277,6 @@ int sptlrpc_lproc_init(void) void sptlrpc_lproc_fini(void) { - if (sptlrpc_proc_root) { - lprocfs_remove(&sptlrpc_proc_root); - sptlrpc_proc_root = NULL; - } + if (!IS_ERR_OR_NULL(sptlrpc_debugfs_dir)) + ldebugfs_remove(&sptlrpc_debugfs_dir); } -- 1.8.3.1