From a6c0e9b20b66cdefdc5a64166ea76d7854e44eb6 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 22 Jan 2025 15:53:52 -0500 Subject: [PATCH] LU-8066 gss: migrate rest of proc files to debugfs For GSS only part of the proc tree was ported to debugfs. Since GSS is a root only thing we can safely move the reset to debugfs. Test-Parameters: trivial Test-Parameters: testgroup=review-dne-selinux-ssk-part-1 Test-Parameters: testgroup=review-dne-selinux-ssk-part-2 Test-Parameters: kerberos=true testlist=sanity-krb5 Change-Id: Ic76bd920ed54c5535d71f36ca8e75dd1904394f3 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57864 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Timothy Day Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/ptlrpc/gss/lproc_gss.c | 49 ++++++++++++------------------------------- lustre/ptlrpc/sec_lproc.c | 17 ++------------- 2 files changed, 15 insertions(+), 51 deletions(-) diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index 73ca57d..31f3846 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -51,7 +51,6 @@ static struct dentry *gss_debugfs_dir_lk; static struct dentry *gss_debugfs_dir; -static struct proc_dir_entry *gss_lprocfs_dir; /* * statistic of "out-of-sequence-window" @@ -155,7 +154,7 @@ sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file, krb5_allow_old_client_csum = val; return count; } -LPROC_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum); +LDEBUGFS_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum); #ifdef HAVE_GSS_KEYRING static int sptlrpc_gss_check_upcall_ns_seq_show(struct seq_file *m, void *data) @@ -178,7 +177,7 @@ static ssize_t sptlrpc_gss_check_upcall_ns_seq_write(struct file *file, gss_check_upcall_ns = val; return count; } -LPROC_SEQ_FOPS(sptlrpc_gss_check_upcall_ns); +LDEBUGFS_SEQ_FOPS(sptlrpc_gss_check_upcall_ns); #endif /* HAVE_GSS_KEYRING */ static int rsi_upcall_seq_show(struct seq_file *m, @@ -222,11 +221,11 @@ out: OBD_FREE(kbuf, count + 1); return rc; } -LPROC_SEQ_FOPS(rsi_upcall); +LDEBUGFS_SEQ_FOPS(rsi_upcall); -static ssize_t lprocfs_rsi_info_seq_write(struct file *file, - const char __user *buffer, - size_t count, void *data) +static ssize_t ldebugfs_rsi_info_seq_write(struct file *file, + const char __user *buffer, + size_t count, void *data) { struct rsi_downcall_data *param; int size = sizeof(*param), rc, checked = 0; @@ -277,7 +276,7 @@ out: return rc ? rc : count; } -LPROC_SEQ_FOPS_WR_ONLY(gss, rsi_info); +LDEBUGFS_FOPS_WR_ONLY(gss, rsi_info); static int rsi_entry_expire_seq_show(struct seq_file *m, void *data) @@ -304,7 +303,7 @@ static ssize_t rsi_entry_expire_seq_write(struct file *file, return count; } -LPROC_SEQ_FOPS(rsi_entry_expire); +LDEBUGFS_SEQ_FOPS(rsi_entry_expire); static int rsi_acquire_expire_seq_show(struct seq_file *m, void *data) @@ -331,11 +330,11 @@ static ssize_t rsi_acquire_expire_seq_write(struct file *file, return count; } -LPROC_SEQ_FOPS(rsi_acquire_expire); +LDEBUGFS_SEQ_FOPS(rsi_acquire_expire); -static ssize_t lprocfs_rsc_info_seq_write(struct file *file, - const char __user *buffer, - size_t count, void *data) +static ssize_t ldebugfs_rsc_info_seq_write(struct file *file, + const char __user *buffer, + size_t count, void *data) { struct rsc_downcall_data *param; int size = sizeof(*param), rc, checked = 0; @@ -426,7 +425,7 @@ out: return rc ? rc : count; } -LPROC_SEQ_FOPS_WR_ONLY(gss, rsc_info); +LDEBUGFS_FOPS_WR_ONLY(gss, rsc_info); static struct ldebugfs_vars gss_debugfs_vars[] = { { .name = "replays", @@ -434,10 +433,6 @@ static struct ldebugfs_vars gss_debugfs_vars[] = { { .name = "init_channel", .fops = &gss_proc_secinit, .proc_mode = 0200 }, - { NULL } -}; - -static struct lprocfs_vars gss_lprocfs_vars[] = { { .name = "krb5_allow_old_client_csum", .fops = &sptlrpc_krb5_allow_old_client_csum_fops }, #ifdef HAVE_GSS_KEYRING @@ -503,15 +498,10 @@ void gss_exit_tunables(void) debugfs_remove_recursive(gss_debugfs_dir); gss_debugfs_dir = NULL; - - if (!IS_ERR_OR_NULL(gss_lprocfs_dir)) - lprocfs_remove(&gss_lprocfs_dir); } int gss_init_tunables(void) { - int rc; - spin_lock_init(&gss_stat_oos.oos_lock); gss_debugfs_dir = debugfs_create_dir("gss", sptlrpc_debugfs_dir); @@ -521,18 +511,5 @@ int gss_init_tunables(void) gss_debugfs_dir); ldebugfs_add_vars(gss_debugfs_dir_lk, gss_lk_debugfs_vars, NULL); - gss_lprocfs_dir = lprocfs_register("gss", sptlrpc_lprocfs_dir, - gss_lprocfs_vars, NULL); - if (IS_ERR_OR_NULL(gss_lprocfs_dir)) { - rc = gss_lprocfs_dir ? PTR_ERR(gss_lprocfs_dir) : -ENOMEM; - gss_lprocfs_dir = NULL; - GOTO(out, rc); - } - return 0; - -out: - CERROR("failed to initialize gss lproc entries: %d\n", rc); - gss_exit_tunables(); - return rc; } diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c index 70336d8..d7f24fb 100644 --- a/lustre/ptlrpc/sec_lproc.c +++ b/lustre/ptlrpc/sec_lproc.c @@ -390,30 +390,17 @@ EXPORT_SYMBOL(sptlrpc_lprocfs_dir); int sptlrpc_lproc_init(void) { - int rc = 0; - - LASSERT(sptlrpc_debugfs_dir == NULL); + LASSERT(!sptlrpc_debugfs_dir); sptlrpc_debugfs_dir = debugfs_create_dir("sptlrpc", debugfs_lustre_root); ldebugfs_add_vars(sptlrpc_debugfs_dir, sptlrpc_lprocfs_vars, NULL); - sptlrpc_lprocfs_dir = lprocfs_register("sptlrpc", proc_lustre_root, - NULL, NULL); - if (IS_ERR_OR_NULL(sptlrpc_lprocfs_dir)) { - rc = PTR_ERR(sptlrpc_lprocfs_dir); - rc = sptlrpc_lprocfs_dir ? PTR_ERR(sptlrpc_lprocfs_dir) - : -ENOMEM; - sptlrpc_lprocfs_dir = NULL; - } - return rc; + return 0; } void sptlrpc_lproc_fini(void) { debugfs_remove_recursive(sptlrpc_debugfs_dir); sptlrpc_debugfs_dir = NULL; - - if (!IS_ERR_OR_NULL(sptlrpc_lprocfs_dir)) - lprocfs_remove(&sptlrpc_lprocfs_dir); } -- 1.8.3.1