linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] CIFS: Print message when attempting mount
@ 2018-10-02  0:58 Rodrigo Freire
  2018-10-02  1:16 ` Pavel Shilovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Freire @ 2018-10-02  0:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: sfrench, linux-cifs

By default, no messages are printed when mounting a CIFS filesystem.
This information is valuable when troubleshooting and/or forensic
analyzing a system and finding out if was a CIFS endpoint mount
attempted.
Other filesystems such as XFS, EXT* does issue a printk() when mounting
their filesystems.

Sample output:

[root@ll-rhel7 ~]# mount -o user=administrator //172.25.250.18/c$ /mnt
(non-existent system)

[root@ll-rhel7 ~]# mount -o user=administrator //172.25.250.19/c$ /mnt
(Valid system)

Kernel message log:

[  450.464543] CIFS VFS: Attempting to mount //172.25.250.18/c$
[  456.478186] CIFS VFS: Error connecting to socket. Aborting operation.
[  456.478381] CIFS VFS: cifs_mount failed w/return code = -113
[  467.688866] CIFS VFS: Attempting to mount //172.25.250.19/c$

Signed-off-by: Rodrigo Freire <rfreire@redhat.com>
---
 fs/cifs/cifsfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 7065426..3f5a31e 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -707,6 +707,7 @@ static int cifs_set_super(struct super_block *sb, void *data)
 	struct cifs_mnt_data mnt_data;
 	struct dentry *root;
 
+	cifs_dbg(VFS, "Attempting to mount %s\n", dev_name);
 	cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);
 
 	volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] CIFS: Print message when attempting mount
  2018-10-02  0:58 [PATCH] CIFS: Print message when attempting mount Rodrigo Freire
@ 2018-10-02  1:16 ` Pavel Shilovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Shilovsky @ 2018-10-02  1:16 UTC (permalink / raw)
  To: rfreire; +Cc: Kernel Mailing List, Steve French, linux-cifs

пн, 1 окт. 2018 г. в 17:59, Rodrigo Freire <rfreire@redhat.com>:
>
> By default, no messages are printed when mounting a CIFS filesystem.
> This information is valuable when troubleshooting and/or forensic
> analyzing a system and finding out if was a CIFS endpoint mount
> attempted.
> Other filesystems such as XFS, EXT* does issue a printk() when mounting
> their filesystems.
>
> Sample output:
>
> [root@ll-rhel7 ~]# mount -o user=administrator //172.25.250.18/c$ /mnt
> (non-existent system)
>
> [root@ll-rhel7 ~]# mount -o user=administrator //172.25.250.19/c$ /mnt
> (Valid system)
>
> Kernel message log:
>
> [  450.464543] CIFS VFS: Attempting to mount //172.25.250.18/c$
> [  456.478186] CIFS VFS: Error connecting to socket. Aborting operation.
> [  456.478381] CIFS VFS: cifs_mount failed w/return code = -113
> [  467.688866] CIFS VFS: Attempting to mount //172.25.250.19/c$
>
> Signed-off-by: Rodrigo Freire <rfreire@redhat.com>

Hi Rodrigo,

> ---
>  fs/cifs/cifsfs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index 7065426..3f5a31e 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -707,6 +707,7 @@ static int cifs_set_super(struct super_block *sb, void *data)
>         struct cifs_mnt_data mnt_data;
>         struct dentry *root;
>
> +       cifs_dbg(VFS, "Attempting to mount %s\n", dev_name);
>         cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);

Let's change the next FYI line to not contain devname thus avoiding
duplicate logging when FYI is enabled.

>
>         volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3);
> --
> 1.8.3.1
>

Other than the comment above I agree with the change.

--
Best regards,
Pavel Shilovsky

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-02  1:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02  0:58 [PATCH] CIFS: Print message when attempting mount Rodrigo Freire
2018-10-02  1:16 ` Pavel Shilovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).