diff mbox

cifs: don't present the cifsFYI procfile when CONFIG_CIFS_DEBUG is disabled

Message ID 1355831339-22043-1-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Dec. 18, 2012, 11:48 a.m. UTC
If all of the debug messages are compiled out, then this knob is no
longer connected to anything useful. There's no point in presenting
it at all in that case.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifs_debug.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Steve French Dec. 20, 2012, 9:25 p.m. UTC | #1
You make a good point that we need to adjust cifsFYI when CONFIG_CIFS_DEBUG
is turned off by embedded distros to save memory but we can't remove it since it
controls CIFS_RC and CIFS_TIMER messages (which we use for debugging,
and should work even with CONFIG_CIFS_DEBUG is turned off - to allow
us to see slow requests and get CIFS/SMB2 network errors logged).

I am fine with the idea of preventing enabling CIFS_INFO in
/proc/fs/cifs/cifsFYI
when CONFIG_CIFS_DEBUG is turned off (e.g. masking off the 0x0004 or
rejecting it if the user tries to set that bit (to enable various informational
messages which aren't going to print) when on an embedded system
with debugging not compiled in).

On Tue, Dec 18, 2012 at 5:48 AM, Jeff Layton <jlayton@redhat.com> wrote:
> If all of the debug messages are compiled out, then this knob is no
> longer connected to anything useful. There's no point in presenting
> it at all in that case.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/cifs_debug.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index d9ea6ed..f5de4c9 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -371,7 +371,11 @@ static const struct file_operations cifs_stats_proc_fops = {
>  #endif /* STATS */
>
>  static struct proc_dir_entry *proc_fs_cifs;
> +
> +#ifdef CONFIG_CIFS_DEBUG
>  static const struct file_operations cifsFYI_proc_fops;
> +#endif /* CONFIG_CIFS_DEBUG */
> +
>  static const struct file_operations cifs_lookup_cache_proc_fops;
>  static const struct file_operations traceSMB_proc_fops;
>  static const struct file_operations cifs_security_flags_proc_fops;
> @@ -389,7 +393,9 @@ cifs_proc_init(void)
>  #ifdef CONFIG_CIFS_STATS
>         proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
>  #endif /* STATS */
> +#ifdef CONFIG_CIFS_DEBUG
>         proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
> +#endif /* CONFIG_CIFS_DEBUG */
>         proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
>         proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
>                     &cifs_linux_ext_proc_fops);
> @@ -406,7 +412,9 @@ cifs_proc_clean(void)
>                 return;
>
>         remove_proc_entry("DebugData", proc_fs_cifs);
> +#ifdef CONFIG_CIFS_DEBUG
>         remove_proc_entry("cifsFYI", proc_fs_cifs);
> +#endif /* CONFIG_CIFS_DEBUG */
>         remove_proc_entry("traceSMB", proc_fs_cifs);
>  #ifdef CONFIG_CIFS_STATS
>         remove_proc_entry("Stats", proc_fs_cifs);
> @@ -417,6 +425,7 @@ cifs_proc_clean(void)
>         remove_proc_entry("fs/cifs", NULL);
>  }
>
> +#ifdef CONFIG_CIFS_DEBUG
>  static int cifsFYI_proc_show(struct seq_file *m, void *v)
>  {
>         seq_printf(m, "%d\n", cifsFYI);
> @@ -455,6 +464,7 @@ static const struct file_operations cifsFYI_proc_fops = {
>         .release        = single_release,
>         .write          = cifsFYI_proc_write,
>  };
> +#endif /* CONFIG_CIFS_DEBUG */
>
>  static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
>  {
> --
> 1.7.11.7
>
Jeff Layton Dec. 23, 2012, 1:54 p.m. UTC | #2
On Thu, 20 Dec 2012 15:25:18 -0600
Steve French <smfrench@gmail.com> wrote:

> You make a good point that we need to adjust cifsFYI when CONFIG_CIFS_DEBUG
> is turned off by embedded distros to save memory but we can't remove it since it
> controls CIFS_RC and CIFS_TIMER messages (which we use for debugging,
> and should work even with CONFIG_CIFS_DEBUG is turned off - to allow
> us to see slow requests and get CIFS/SMB2 network errors logged).
> 
> I am fine with the idea of preventing enabling CIFS_INFO in
> /proc/fs/cifs/cifsFYI
> when CONFIG_CIFS_DEBUG is turned off (e.g. masking off the 0x0004 or
> rejecting it if the user tries to set that bit (to enable various informational
> messages which aren't going to print) when on an embedded system
> with debugging not compiled in).
> 

Fair enough. I'll drop this patch then.
diff mbox

Patch

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index d9ea6ed..f5de4c9 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -371,7 +371,11 @@  static const struct file_operations cifs_stats_proc_fops = {
 #endif /* STATS */
 
 static struct proc_dir_entry *proc_fs_cifs;
+
+#ifdef CONFIG_CIFS_DEBUG
 static const struct file_operations cifsFYI_proc_fops;
+#endif /* CONFIG_CIFS_DEBUG */
+
 static const struct file_operations cifs_lookup_cache_proc_fops;
 static const struct file_operations traceSMB_proc_fops;
 static const struct file_operations cifs_security_flags_proc_fops;
@@ -389,7 +393,9 @@  cifs_proc_init(void)
 #ifdef CONFIG_CIFS_STATS
 	proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
 #endif /* STATS */
+#ifdef CONFIG_CIFS_DEBUG
 	proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
+#endif /* CONFIG_CIFS_DEBUG */
 	proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
 	proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
 		    &cifs_linux_ext_proc_fops);
@@ -406,7 +412,9 @@  cifs_proc_clean(void)
 		return;
 
 	remove_proc_entry("DebugData", proc_fs_cifs);
+#ifdef CONFIG_CIFS_DEBUG
 	remove_proc_entry("cifsFYI", proc_fs_cifs);
+#endif /* CONFIG_CIFS_DEBUG */
 	remove_proc_entry("traceSMB", proc_fs_cifs);
 #ifdef CONFIG_CIFS_STATS
 	remove_proc_entry("Stats", proc_fs_cifs);
@@ -417,6 +425,7 @@  cifs_proc_clean(void)
 	remove_proc_entry("fs/cifs", NULL);
 }
 
+#ifdef CONFIG_CIFS_DEBUG
 static int cifsFYI_proc_show(struct seq_file *m, void *v)
 {
 	seq_printf(m, "%d\n", cifsFYI);
@@ -455,6 +464,7 @@  static const struct file_operations cifsFYI_proc_fops = {
 	.release	= single_release,
 	.write		= cifsFYI_proc_write,
 };
+#endif /* CONFIG_CIFS_DEBUG */
 
 static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
 {