Re: [PATCH v3 0/2] CIFS: Info-level log support, print message when attempting mount.

From: Steve French
Date: Sun Oct 07 2018 - 14:59:08 EST


Merged into cifs-2.6.git for-next

Made a trivial tab/space correction in the patch (pointed out by
checkpatch) and then added a trivial followon patch to address a
comment/style (trivial)
issue pointed out by checkpatch and to add a little more detailed
comments about generally when to use each debug function. If any
objections let me know.


On Sun, Oct 7, 2018 at 10:21 AM Rodrigo Freire <rfreire@xxxxxxxxxx> wrote:
>
> Hi Steve,
> From our conversation over v2, I came out with this v3 patch, which I broke
> in two commits:
>
> * The first commit in cifs_debug.h, creating the cifs_info() function.
> - The aim of this commit is to allow to the developer to be able to print
> informational-level data without having to use pr_info, pr_notice etc,
> in line with other filesystems.
> . One interesting and noteworthy feature of cifs_info() is that it is
> transparent to the CIFS_DEBUG config state, either in "y" or "n".
> . Also, by using KERN_INFO level, it can be safely filtered by a
> maintainer / administrator, without cluttering their log monitors,
> since this is a low level alert.
> - I took the liberty to not add it inside the existing pr_debug, because
> of the eventual need of some developer to print stuff that should be
> printed not only in CIFS_DEBUG mode (as there are plenty of pr_notice
> scattered over the code).
> - Also, this is not a debug but a info message, so i liked cifs_info()
> more ;-)
> - I saw plenty of pr_notice() in CIFS code, but I resisted the urge to
> convert them to cifs_info().
>
> * The second commit contains the code printing a cifs_info() when attempting
> a CIFS mount operation.
>
> Appreciate your review.
>
> V3: Created a new cifs_info() function, moved the mount attempt message to
> cifs_info
>
> V2: Created a loop to select the right cifs_dbg message to be printed,
> considering the current system's scenario, in order to avoid a
> duplicate message or stripping out important information in
> debug.
>
> Rodrigo Freire (2):
> CIFS: Adds information-level logging function
> CIFS: Print message when attempting a mount
>
> fs/cifs/cifs_debug.h | 16 ++++++++++++++++
> fs/cifs/cifsfs.c | 7 ++++++-
> fs/cifs/transport.c | 2 +-
> 3 files changed, 23 insertions(+), 2 deletions(-)
>
> --
> 1.8.3.1
>


--
Thanks,

Steve
From 4c939344f94a273a1eab89cf58f74c9ad68a8a8d Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Sun, 7 Oct 2018 13:52:18 -0500
Subject: [PATCH] cifs: minor clarification in comments

Clarify meaning (in comments) meaning of various
options for debug messages in cifs.ko. Also fixed
trivial formatting/style issue with previous patch.

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
fs/cifs/cifs_debug.h | 12 ++++++++++++
fs/cifs/cifsfs.c | 6 ++++--
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
index 72db2987e066..631dc1bb21c1 100644
--- a/fs/cifs/cifs_debug.h
+++ b/fs/cifs/cifs_debug.h
@@ -47,6 +47,18 @@ extern int cifsFYI;
*/
#ifdef CONFIG_CIFS_DEBUG

+
+/*
+ * When adding tracepoints and debug messages we have various choices.
+ * Some considerations:
+ *
+ * Use cifs_dbg(VFS, ...) for things we always want logged, and the user to see
+ * cifs_info(...) slightly less important, admin can filter via loglevel > 6
+ * cifs_dbg(FYI, ...) minor debugging messages, off by default
+ * trace_smb3_* ftrace functions are preferred for complex debug messages
+ * intended for developers or experienced admins, off by default
+ */
+
/* Information level messages, minor events */
#define cifs_info_func(ratefunc, fmt, ...) \
do { \
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index d78a31560995..7de9603c54f1 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -717,8 +717,10 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
struct cifs_mnt_data mnt_data;
struct dentry *root;

- /* Prints in Kernel / CIFS log the attempted mount operation *
- * IF CIFS_DEBUG && cifs_FYI */
+ /*
+ * Prints in Kernel / CIFS log the attempted mount operation
+ * If CIFS_DEBUG && cifs_FYI
+ */
if (cifsFYI)
cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);
else
--
2.17.1