All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: rfreire@redhat.com
Cc: LKML <linux-kernel@vger.kernel.org>,
	Steve French <sfrench@samba.org>,
	CIFS <linux-cifs@vger.kernel.org>,
	Pavel Shilovsky <piastryyy@gmail.com>
Subject: Re: [PATCH v2] CIFS: Print message when attempting a mount
Date: Tue, 2 Oct 2018 14:17:02 -0500	[thread overview]
Message-ID: <CAH2r5mtu9XbQfR=QevDqu36ZRYah1hrRGSQyynCfr82PRyunwQ@mail.gmail.com> (raw)
In-Reply-To: <ad6b338c900a17c4ecb1655a42b954221f242be2.1538480816.git.rfreire@redhat.com>

Are you sure that these aren't logged by the automounter (for ext4,
xfs etc.).  When I looked in my dmesg logs I didn't find matching log
entries in the file systems themselves.  Do you have an example?

On the idea of adding cifsFYI logging here - I slightly prefer using
ftrace (trace-cmd, ie dynamic tracing) so there is less overhead and
easier to turn on/off following the example of xfs, f2fs, nfs, nfsd
etc.
On Tue, Oct 2, 2018 at 6:57 AM Rodrigo Freire <rfreire@redhat.com> wrote:
>
> Currently, no messages are printed when mounting a CIFS filesystem and
> no debug configuration is enabled.
>
> However, a CIFS mount 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.
>
> A terse log message is printed only if cifsFYI is not enabled.
>
> Sample mount operations:
>
> [root@corinthians ~]# mount -o user=administrator //172.25.250.18/c$ /mnt
> (non-existent system)
>
> [root@corinthians ~]# mount -o user=administrator //172.25.250.19/c$ /mnt
> (Valid system)
>
> Kernel message log for the mount operations:
>
> [  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$
>
> 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.
>
> Signed-off-by: Rodrigo Freire <rfreire@redhat.com>
> ---
>  fs/cifs/cifsfs.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index 7065426..7fde6bc 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -707,7 +707,11 @@ static int cifs_set_super(struct super_block *sb, void *data)
>         struct cifs_mnt_data mnt_data;
>         struct dentry *root;
>
> -       cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);
> +       /* Prints in Kernel / CIFS log the attempted mount operation */
> +       if (cifsFYI)
> +               cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);
> +       else
> +               cifs_dbg(VFS, "Attempting to mount %s\n", dev_name);
>
>         volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3);
>         if (IS_ERR(volume_info))
> --
> 1.8.3.1
>


-- 
Thanks,

Steve

  reply	other threads:[~2018-10-02 19:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 11:57 [PATCH v2] CIFS: Print message when attempting a mount Rodrigo Freire
2018-10-02 19:17 ` Steve French [this message]
2018-10-02 19:28   ` Rodrigo Freire
2018-10-02 20:35     ` Steve French
2018-10-02 21:20       ` Rodrigo Freire
2018-10-02 21:25         ` Steve French
2018-10-02 21:53           ` Rodrigo Freire
2018-10-06 17:13             ` Steve French
2018-10-06 19:09             ` Steve French
2018-10-06 19:32               ` Rodrigo Freire
2018-10-06 23:27                 ` Steve French

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='CAH2r5mtu9XbQfR=QevDqu36ZRYah1hrRGSQyynCfr82PRyunwQ@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=piastryyy@gmail.com \
    --cc=rfreire@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.