linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Freire <rfreire@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: sfrench@samba.org, linux-cifs@vger.kernel.org
Subject: [PATCH] CIFS: Print message when attempting mount
Date: Mon,  1 Oct 2018 21:58:46 -0300	[thread overview]
Message-ID: <463f424e3d4724a4ab7b84c395e7b0cf3068e31f.1538441538.git.rfreire@redhat.com> (raw)

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


             reply	other threads:[~2018-10-02  0:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  0:58 Rodrigo Freire [this message]
2018-10-02  1:16 ` [PATCH] CIFS: Print message when attempting mount Pavel Shilovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463f424e3d4724a4ab7b84c395e7b0cf3068e31f.1538441538.git.rfreire@redhat.com \
    --to=rfreire@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).