Whamcloud - gitweb
LU-8066 libcfs: migrate to debugfs 88/24688/28
authorDmitry Eremin <dmitry.eremin@intel.com>
Fri, 28 Jul 2017 20:51:52 +0000 (16:51 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 5 Aug 2017 05:10:46 +0000 (05:10 +0000)
commit7092309f32516cbfb95a964c87b8030129edeb27
tree70ecd9a1c6418cc32ceaa86ca69d0c1660f4d595
parentd92bd22523aa9bb1cdb91ded3d46fb180f68a93c
LU-8066 libcfs: migrate to debugfs

move /proc/sys/lnet to debugfs

Parameters in lnet sysctl are of debug quality, so let's move them
to debugfs instead.

Linux-commit: 0871d551af37c72c308397c16c31bae945e6a79d

Remove redundant lnet debugfs variables

/proc/sys/lnet/console_ratelimit, debug_path and panic_on_lbug
are module parameters with no special magic accessible via
/sys/module/libcfs/parameters/libcfs_console_ratelimit,
/sys/module/libcfs/parameters/libcfs_debug_file_path and
/sys/module/libcfs/parameters/libcfs_panic_on_lbug respectively.

As such just replace them with corresponding symlinks

Linux-commit: 1b4d97b6c6ca05446ff33843a7b174cdd765df5a

get rid of debugfs/lnet/console_backoff

module parameter libcfs_console_backoff accessible through
/sys/module/libcfs/parameters/libcfs_console_backoff would
do the same thing, just add a special "uintpos" parameter
type to disallow 0 values too.

Also add a symlink to the module parameter variable for
backwards compatibility

Linux-commit: 8710427dd68f4dff8976d221e220317cea20ecec

get rid of debugfs/lnet/debug_mb

It's just a fancy libcfs_debug_mb module parameter wrapper,
so just add debug buffer size check and resizing and the same
functionality now would be accessible via
/sys/module/libcfs/parameters/libcfs_debug_mb

Also add a symlink for backwards compatibility.

Linux-commit: 8dc08446d0671709bdec9e037845b014e33663b1

get rid of debugfs/lnet/console_{min, max}_delay_centisecs

They are just fancy module parameters wrappers,
so just the same functionality now would be accessible via
/sys/module/libcfs/parameters/libcfs_console_{min,max}_delay

Also install compatibility symlinks

Linux-commit: 35ca907d245e8c218f39b6ed8bd6a1c656d056cc

Fix kstrtouint return value check fix

Apparently kstrtouint could return not just -EINVAL, but also -ERANGE,
so make sure we just check the return value for something negative.

Noticed by Dan Carpenter <dan.carpenter@oracle.com>

Linux-commit: aa66d6f87f300b15ac2efdcde9e198bf5a9020ce

Properly handle debugfs read- and write-only files

It turns out that unlike procfs, debugfs does not really enforce
permissions for root (similar to regular filesystems), so we need
to ensure we are not providing ->write() method to read-only files
and ->read() method for write-only files at registration.

This fixes a couple of crashes on unexpected access.

Linux-commit:49a76d7040b466dd92f198ded4aba3cd3569d48f

Change-Id: I69ff4d9766969f2ca5d5478d4e822879ee78b467
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24688
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/linux/linux-misc.h
libcfs/libcfs/debug.c
libcfs/libcfs/module.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h