Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2633938imm; Sun, 7 Oct 2018 08:22:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV63OZX3YtYRA2T6pXs/1L8mjhtacPnFDOqqzjXtW7h2KeDRtI0jNrpe9X9PcbNdHyDDbz1uj X-Received: by 2002:aa7:80cd:: with SMTP id a13-v6mr20965747pfn.86.1538925724846; Sun, 07 Oct 2018 08:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538925724; cv=none; d=google.com; s=arc-20160816; b=zz7R08EB+lUQnSX5j6umSYFr8pDnWqNvdncUaAmxxbE+u34vX7N68NqFESMRbikbQu PL+8Rs2PQ0nfYiy7Qe4mkDoSs5QaF0eO+AmsgjmHJCJoN0ufj/n8f8M0Ngau+H8Kx7dn ZsmWfG2LDeJddHx3C/TQM0EZhc1yTksH/I1twtP4t6xmnII9uS1pOCyfOfaucuq6KZzX 8AFs8kLoCLzdaZBAePn3AsKar3LL7y5ywDRHum5DzvOwV0am7+j/SMUKapc4+c4UEMBe TLYuaJW+TyQ0xmfE0daSD5Oi/qil+OL5oN7mKNWzdjzi0OK2CyOGeAgWmvVc4wufOM26 7kgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=68m1tT2u+n9DHuDp2GmRb9NNYZvNT4lDickZmpX0d7I=; b=aXgh09LkZAZXjdKUc7PeLxbv+uV3rLFrXSRCx5ujRCIdkcb3y8BKgnXW2n05ID9PF1 PhzzcMkb4sFITDyJUb5gU+lJxEPMjiocSlUaZHdDKqIr09J656ACZMfo8aio8NeM18jt Dx8yxfl1uTS5Oi8Nrjid94BLJJRawPUsOk+oPQdwqwraaz+jKa0xSAXWcJHBj5gQg4QS I34F5vCNGijcT+CuyUTHObG1LCQQMk8HKmzAv/pGM0udatlZWiBfxhL3NvF641+K5JHy pDUs9HNTCU3mbhpj+C5/dGaFBRoTqat/D46083t9SfGyfv1e0fkQTo6Z7yUhAvJMbzze PIYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si14747733pgn.46.2018.10.07.08.21.49; Sun, 07 Oct 2018 08:22:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbeJGW3R (ORCPT + 99 others); Sun, 7 Oct 2018 18:29:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45634 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbeJGW3Q (ORCPT ); Sun, 7 Oct 2018 18:29:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFD19308212B; Sun, 7 Oct 2018 15:21:40 +0000 (UTC) Received: from rf.usersys.redhat.com (ovpn-116-29.gru2.redhat.com [10.97.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F90C10021B2; Sun, 7 Oct 2018 15:21:39 +0000 (UTC) From: Rodrigo Freire To: linux-kernel@vger.kernel.org Cc: sfrench@samba.org, linux-cifs@vger.kernel.org, piastryyy@gmail.com Subject: [PATCH v3 2/2] CIFS: Print message when attempting a mount Date: Sun, 7 Oct 2018 12:21:26 -0300 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sun, 07 Oct 2018 15:21:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Otherwise, the default full debug message is printed. In order to not clutter and classify correctly the event messages, these are logged as KERN_INFO level. 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: 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: Attempting to mount //172.25.250.19/c$ Signed-off-by: Rodrigo Freire --- fs/cifs/cifsfs.c | 7 ++++++- fs/cifs/transport.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 7065426..ebdf25e 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -707,7 +707,12 @@ 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 CIFS_DEBUG && cifs_FYI */ + if (cifsFYI) + cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags); + else + cifs_info("Attempting to mount %s\n", dev_name); volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3); if (IS_ERR(volume_info)) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 78f96fa..c2afd6a 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -128,7 +128,7 @@ void cifs_mid_q_entry_release(struct mid_q_entry *midEntry) if (cifsFYI & CIFS_TIMER) { pr_debug(" CIFS slow rsp: cmd %d mid %llu", midEntry->command, midEntry->mid); - pr_info(" A: 0x%lx S: 0x%lx R: 0x%lx\n", + cifs_info(" A: 0x%lx S: 0x%lx R: 0x%lx\n", now - midEntry->when_alloc, now - midEntry->when_sent, now - midEntry->when_received); -- 1.8.3.1