X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fgss%2Flproc_gss.c;h=29e5c49a707b1fda06211da5c6027ebf6b21f223;hb=4dfe4a49ccab3d087c14c8b3d539061f9f7f4b75;hp=06f219eb65ae21185b2821002c6bd9424ed298a7;hpb=294e507d34de0d7990ec507334f71ff1d1a7db01;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index 06f219e..29e5c49 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,7 +23,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2016, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -35,21 +31,16 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include #include -#else -#include -#endif #include #include #include -#include #include #include #include @@ -59,8 +50,9 @@ #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; +static struct proc_dir_entry *gss_lprocfs_dir; /* * statistic of "out-of-sequence-window" @@ -100,27 +92,28 @@ void gss_stat_oos_record_svc(int phase, int replay) static int gss_proc_oos_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "seqwin: %u\n" - "backwin: %u\n" - "client fall behind seqwin\n" - " occurrence: %d\n" - " max seq behind: %d\n" - "server replay detected:\n" - " phase 0: %d\n" - " phase 1: %d\n" - " phase 2: %d\n" - "server verify ok:\n" - " phase 2: %d\n", - GSS_SEQ_WIN_MAIN, - GSS_SEQ_WIN_BACK, - atomic_read(&gss_stat_oos.oos_cli_count), - gss_stat_oos.oos_cli_behind, - atomic_read(&gss_stat_oos.oos_svc_replay[0]), - atomic_read(&gss_stat_oos.oos_svc_replay[1]), - atomic_read(&gss_stat_oos.oos_svc_replay[2]), - atomic_read(&gss_stat_oos.oos_svc_pass[2])); + seq_printf(m, "seqwin: %u\n" + "backwin: %u\n" + "client fall behind seqwin\n" + " occurrence: %d\n" + " max seq behind: %d\n" + "server replay detected:\n" + " phase 0: %d\n" + " phase 1: %d\n" + " phase 2: %d\n" + "server verify ok:\n" + " phase 2: %d\n", + GSS_SEQ_WIN_MAIN, + GSS_SEQ_WIN_BACK, + atomic_read(&gss_stat_oos.oos_cli_count), + gss_stat_oos.oos_cli_behind, + atomic_read(&gss_stat_oos.oos_svc_replay[0]), + atomic_read(&gss_stat_oos.oos_svc_replay[1]), + atomic_read(&gss_stat_oos.oos_svc_replay[2]), + 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, @@ -140,7 +133,29 @@ static const struct file_operations gss_proc_secinit = { .write = gss_proc_write_secinit, }; -static struct lprocfs_seq_vars gss_lprocfs_vars[] = { +int sptlrpc_krb5_allow_old_client_csum_seq_show(struct seq_file *m, void *data) +{ + seq_printf(m, "%u\n", krb5_allow_old_client_csum); + return 0; +} + +ssize_t sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) +{ + bool val; + int rc; + + rc = kstrtobool_from_user(buffer, count, &val); + if (rc) + return rc; + + krb5_allow_old_client_csum = val; + return count; +} +LPROC_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum); + +static struct lprocfs_vars gss_debugfs_vars[] = { { .name = "replays", .fops = &gss_proc_oos_fops }, { .name = "init_channel", @@ -149,6 +164,12 @@ static struct lprocfs_seq_vars gss_lprocfs_vars[] = { { NULL } }; +static struct lprocfs_vars gss_lprocfs_vars[] = { + { .name = "krb5_allow_old_client_csum", + .fops = &sptlrpc_krb5_allow_old_client_csum_fops }, + { NULL } +}; + /* * for userspace helper lgss_keyring. * @@ -158,65 +179,66 @@ static int gss_lk_debug_level = 1; static int gss_lk_proc_dl_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "%u\n", gss_lk_debug_level); + seq_printf(m, "%u\n", gss_lk_debug_level); + return 0; } static ssize_t -gss_lk_proc_dl_seq_write(struct file *file, const char *buffer, +gss_lk_proc_dl_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { - int val, rc; + unsigned int val; + int rc; - rc = lprocfs_write_helper(buffer, count, &val); - if (rc < 0) - return rc; + rc = kstrtouint_from_user(buffer, count, 0, &val); + if (rc < 0) + return rc; - if (val < 0 || val > 4) - return -ERANGE; + if (val > 4) + return -ERANGE; - gss_lk_debug_level = val; - return count; + gss_lk_debug_level = val; + + return count; } -LPROC_SEQ_FOPS(gss_lk_proc_dl); +LDEBUGFS_SEQ_FOPS(gss_lk_proc_dl); -static struct lprocfs_seq_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; - } + debugfs_remove_recursive(gss_debugfs_dir_lk); + gss_debugfs_dir_lk = NULL; - if (gss_proc_root) { - lprocfs_remove(&gss_proc_root); - gss_proc_root = NULL; - } + 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_lproc(void) +int gss_init_tunables(void) { int rc; spin_lock_init(&gss_stat_oos.oos_lock); - gss_proc_root = lprocfs_seq_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; - GOTO(out, rc); - } + gss_debugfs_dir = debugfs_create_dir("gss", sptlrpc_debugfs_dir); + ldebugfs_add_vars(gss_debugfs_dir, gss_debugfs_vars, NULL); + + gss_debugfs_dir_lk = debugfs_create_dir("lgss_keyring", + gss_debugfs_dir); + ldebugfs_add_vars(gss_debugfs_dir_lk, gss_lk_debugfs_vars, NULL); - gss_proc_lk = lprocfs_seq_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_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); } @@ -224,7 +246,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; }