]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smb: client: improve error message when creating SMB session
authorPaulo Alcantara <pc@manguebit.org>
Thu, 4 Dec 2025 18:06:24 +0000 (15:06 -0300)
committerSteve French <stfrench@microsoft.com>
Fri, 5 Dec 2025 23:40:38 +0000 (17:40 -0600)
When failing to create a new SMB session with 'sec=krb5' for example,
the following error message isn't very useful

CIFS: VFS: \\srv Send error in SessSetup = -126

Improve it by printing the following instead on dmesg

CIFS: VFS: \\srv failed to create a new SMB session with Kerberos: -126

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Pierguido Lambri <plambri@redhat.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/connect.c

index 0d4f45444380f3ed129fbeeac0d7ca5c6186bdb4..ce620503e9f7023fa53eb732fc6007b641eb0f48 100644 (file)
@@ -4238,8 +4238,10 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
        struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&pserver->dstaddr;
        struct sockaddr_in *addr = (struct sockaddr_in *)&pserver->dstaddr;
        bool is_binding = false;
+       bool new_ses;
 
        spin_lock(&ses->ses_lock);
+       new_ses = ses->ses_status == SES_NEW;
        cifs_dbg(FYI, "%s: channel connect bitmap: 0x%lx\n",
                 __func__, ses->chans_need_reconnect);
 
@@ -4325,7 +4327,10 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
        }
 
        if (rc) {
-               cifs_server_dbg(VFS, "Send error in SessSetup = %d\n", rc);
+               if (new_ses) {
+                       cifs_server_dbg(VFS, "failed to create a new SMB session with %s: %d\n",
+                                       get_security_type_str(ses->sectype), rc);
+               }
                spin_lock(&ses->ses_lock);
                if (ses->ses_status == SES_IN_SETUP)
                        ses->ses_status = SES_NEED_RECON;