Skip to contentSkip to conversation

cifs: reduce warning log level for server not advertising interfaces

PATCH In review [email protected] 2 participants 5 messages Mar 13, 2024 – Mar 14, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cifs: reduce warning log level for server not advertising interfaces

From: Shyam Prasad N <[email protected]>

Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and it suggests that this situation is expected for some configurations (for example SMB2.1).

Since the function returns appropriately even for such cases, it is fairly harmless to make this a debug log. When needed, the verbosity can be increased to capture this log.

---
 fs/smb/client/sess.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/sess.c +2 -2
index 8f37373fd333..37cdf5b55108 100644
@@ -230,7 +230,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses)
 		spin_lock(&ses->iface_lock);
 		if (!ses->iface_count) {
 			spin_unlock(&ses->iface_lock);
-			cifs_dbg(VFS, "server %s does not advertise interfaces\n",
+			cifs_dbg(FYI, "server %s does not advertise interfaces\n",
 				      ses->server->hostname);
 			break;
 		}
@@ -396,7 +396,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
 	spin_lock(&ses->iface_lock);
 	if (!ses->iface_count) {
 		spin_unlock(&ses->iface_lock);
-		cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname);
+		cifs_dbg(FYI, "server %s does not advertise interfaces\n", ses->server->hostname);
 		return;
 	}
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 cifs: make sure server interfaces are requested only for SMB3+

From: Shyam Prasad N <[email protected]>

Some code paths for querying server interfaces make a false assumption that it will only get called for SMB3+. Since this function now can get called from a generic code paths, the correct thing to do is to have specific handler for this functionality per SMB dialect, and call this handler.

This change adds such a handler and implements this handler only for SMB 3.0 and 3.1.1.

---
 fs/smb/client/cifsglob.h | 3 +++
 fs/smb/client/connect.c  | 6 +++++-
 fs/smb/client/smb2ops.c  | 2 ++
 fs/smb/client/smb2pdu.c  | 5 +++--
 4 files changed, 13 insertions(+), 3 deletions(-)
fs/smb/client/cifsglob.h +3 -0
index 53c75cfb33ab..b29b57ab9807 100644
@@ -346,6 +346,9 @@ struct smb_version_operations {
 	/* informational QFS call */
 	void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
 			 struct cifs_sb_info *);
+	/* query for server interfaces */
+	int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
+				       bool);
 	/* check if a path is accessible or not */
 	int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
 				  struct cifs_sb_info *, const char *);
fs/smb/client/connect.c +5 -1
index ac9595504f4b..234160460615 100644
@@ -123,12 +123,16 @@ static void smb2_query_server_interfaces(struct work_struct *work)
 	struct cifs_tcon *tcon = container_of(work,
 					struct cifs_tcon,
 					query_interfaces.work);
+	struct TCP_Server_Info *server = tcon->ses->server;
 
 	/*
 	 * query server network interfaces, in case they change
 	 */
+	if (!server->ops->query_server_interfaces)
+		return;
+
 	xid = get_xid();
-	rc = SMB3_request_interfaces(xid, tcon, false);
+	rc = server->ops->query_server_interfaces(xid, tcon, false);
 	free_xid(xid);
 
 	if (rc) {
fs/smb/client/smb2ops.c +2 -0
index 4695433fcf39..3b8896987197 100644
@@ -5538,6 +5538,7 @@ struct smb_version_operations smb30_operations = {
 	.tree_connect = SMB2_tcon,
 	.tree_disconnect = SMB2_tdis,
 	.qfs_tcon = smb3_qfs_tcon,
+	.query_server_interfaces = SMB3_request_interfaces,
 	.is_path_accessible = smb2_is_path_accessible,
 	.can_echo = smb2_can_echo,
 	.echo = SMB2_echo,
@@ -5653,6 +5654,7 @@ struct smb_version_operations smb311_operations = {
 	.tree_connect = SMB2_tcon,
 	.tree_disconnect = SMB2_tdis,
 	.qfs_tcon = smb3_qfs_tcon,
+	.query_server_interfaces = SMB3_request_interfaces,
 	.is_path_accessible = smb2_is_path_accessible,
 	.can_echo = smb2_can_echo,
 	.echo = SMB2_echo,
fs/smb/client/smb2pdu.c +3 -2
index 608ee05491e2..4fa47c59cc04 100644
@@ -409,14 +409,15 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
 	spin_unlock(&ses->ses_lock);
 
 	if (!rc &&
-	    (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
+	    (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) &&
+	    server->ops->query_server_interfaces) {
 		mutex_unlock(&ses->session_mutex);
 
 		/*
 		 * query server network interfaces, in case they change
 		 */
 		xid = get_xid();
-		rc = SMB3_request_interfaces(xid, tcon, false);
+		rc = server->ops->query_server_interfaces(xid, tcon, false);
 		free_xid(xid);
 
 		if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
Signature · 1 line
2.34.1
#3 lore raw
In reply to [email protected]

what about simply a "warn_once" since it is useful for the user to know that their server does not advertise interfaces so can affect performance (multichannel) and perhaps some reconnect scenarios.

Quoted 44 lines · On Wed, Mar 13, 2024 at 5:40 AM <[email protected]> wrote:

From: Shyam Prasad N <[email protected]>

Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and it suggests that this situation is expected for some configurations (for example SMB2.1).

Since the function returns appropriately even for such cases, it is fairly harmless to make this a debug log. When needed, the verbosity can be increased to capture this log.

---
 fs/smb/client/sess.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/sess.c +2 -3
index 8f37373fd333..37cdf5b55108 100644
@@ -230,7 +230,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses)
                spin_lock(&ses->iface_lock);
                if (!ses->iface_count) {
                        spin_unlock(&ses->iface_lock);
-                       cifs_dbg(VFS, "server %s does not advertise interfaces\n",
+                       cifs_dbg(FYI, "server %s does not advertise interfaces\n",
                                      ses->server->hostname);
                        break;
                }
@@ -396,7 +396,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
        spin_lock(&ses->iface_lock);
        if (!ses->iface_count) {
                spin_unlock(&ses->iface_lock);
-               cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname);
+               cifs_dbg(FYI, "server %s does not advertise interfaces\n", ses->server->hostname);
                return;
        }
 
--

2.34.1

Signature · 3 lines
Thanks,

Steve
#2 lore raw

Re: [PATCH 2/2] cifs: make sure server interfaces are requested only for SMB3+

In reply to [email protected]

tentatively merged to cifs-2.6.git for-next pending testing and additional review

Quoted 104 lines · On Wed, Mar 13, 2024 at 5:40 AM <[email protected]> wrote:

From: Shyam Prasad N <[email protected]>

Some code paths for querying server interfaces make a false assumption that it will only get called for SMB3+. Since this function now can get called from a generic code paths, the correct thing to do is to have specific handler for this functionality per SMB dialect, and call this handler.

This change adds such a handler and implements this handler only for SMB 3.0 and 3.1.1.

---
 fs/smb/client/cifsglob.h | 3 +++
 fs/smb/client/connect.c  | 6 +++++-
 fs/smb/client/smb2ops.c  | 2 ++
 fs/smb/client/smb2pdu.c  | 5 +++--
 4 files changed, 13 insertions(+), 3 deletions(-)
fs/smb/client/cifsglob.h +3 -0
index 53c75cfb33ab..b29b57ab9807 100644
@@ -346,6 +346,9 @@ struct smb_version_operations {
        /* informational QFS call */
        void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
                         struct cifs_sb_info *);
+       /* query for server interfaces */
+       int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
+                                      bool);
        /* check if a path is accessible or not */
        int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
                                  struct cifs_sb_info *, const char *);
fs/smb/client/connect.c +5 -1
index ac9595504f4b..234160460615 100644
@@ -123,12 +123,16 @@ static void smb2_query_server_interfaces(struct work_struct *work)
        struct cifs_tcon *tcon = container_of(work,
                                        struct cifs_tcon,
                                        query_interfaces.work);
+       struct TCP_Server_Info *server = tcon->ses->server;
 
        /*
         * query server network interfaces, in case they change
         */
+       if (!server->ops->query_server_interfaces)
+               return;
+
        xid = get_xid();
-       rc = SMB3_request_interfaces(xid, tcon, false);
+       rc = server->ops->query_server_interfaces(xid, tcon, false);
        free_xid(xid);
 
        if (rc) {
fs/smb/client/smb2ops.c +2 -0
index 4695433fcf39..3b8896987197 100644
@@ -5538,6 +5538,7 @@ struct smb_version_operations smb30_operations = {
        .tree_connect = SMB2_tcon,
        .tree_disconnect = SMB2_tdis,
        .qfs_tcon = smb3_qfs_tcon,
+       .query_server_interfaces = SMB3_request_interfaces,
        .is_path_accessible = smb2_is_path_accessible,
        .can_echo = smb2_can_echo,
        .echo = SMB2_echo,
@@ -5653,6 +5654,7 @@ struct smb_version_operations smb311_operations = {
        .tree_connect = SMB2_tcon,
        .tree_disconnect = SMB2_tdis,
        .qfs_tcon = smb3_qfs_tcon,
+       .query_server_interfaces = SMB3_request_interfaces,
        .is_path_accessible = smb2_is_path_accessible,
        .can_echo = smb2_can_echo,
        .echo = SMB2_echo,
fs/smb/client/smb2pdu.c +3 -3
index 608ee05491e2..4fa47c59cc04 100644
@@ -409,14 +409,15 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
        spin_unlock(&ses->ses_lock);
 
        if (!rc &&
-           (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
+           (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) &&
+           server->ops->query_server_interfaces) {
                mutex_unlock(&ses->session_mutex);
 
                /*
                 * query server network interfaces, in case they change
                 */
                xid = get_xid();
-               rc = SMB3_request_interfaces(xid, tcon, false);
+               rc = server->ops->query_server_interfaces(xid, tcon, false);
                free_xid(xid);
 
                if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
--

2.34.1

Signature · 3 lines
Thanks,

Steve
#4 lore raw
In reply to Steve French

updated patch to change to warn once, and to fix a minor checkpatch warning (about format of stable tag)

Quoted 56 lines · Steve French

what about simply a "warn_once" since it is useful for the user to know that their server does not advertise interfaces so can affect performance (multichannel) and perhaps some reconnect scenarios.

Quoted 42 lines · On Wed, Mar 13, 2024 at 5:40 AM <[email protected]> wrote:

From: Shyam Prasad N <[email protected]>

Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and it suggests that this situation is expected for some configurations (for example SMB2.1).

Since the function returns appropriately even for such cases, it is fairly harmless to make this a debug log. When needed, the verbosity can be increased to capture this log.

---
 fs/smb/client/sess.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/sess.c +2 -3
index 8f37373fd333..37cdf5b55108 100644
@@ -230,7 +230,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses)
                spin_lock(&ses->iface_lock);
                if (!ses->iface_count) {
                        spin_unlock(&ses->iface_lock);
-                       cifs_dbg(VFS, "server %s does not advertise interfaces\n",
+                       cifs_dbg(FYI, "server %s does not advertise interfaces\n",
                                      ses->server->hostname);
                        break;
                }
@@ -396,7 +396,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
        spin_lock(&ses->iface_lock);
        if (!ses->iface_count) {
                spin_unlock(&ses->iface_lock);
-               cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname);
+               cifs_dbg(FYI, "server %s does not advertise interfaces\n", ses->server->hostname);
                return;
        }
 
--
Quoted 2 lines

2.34.1

--
Thanks,

Steve

Signature · 3 lines
Thanks,

Steve

From 21dd8df65a7f87ecc928ad325ab163ab08a556be Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <[email protected]>
Date: Wed, 13 Mar 2024 10:40:40 +0000
Subject: [PATCH 2/4] cifs: reduce warning log level for server not advertising
interfaces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and it suggests that this situation is expected for some configurations (for example SMB2.1).

Since the function returns appropriately even for such cases, it is fairly harmless to make this a debug log. When needed, the verbosity can be increased to capture this log.

---
 fs/smb/client/sess.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/sess.c +2 -2
index 8f37373fd333..3216f786908f 100644
@@ -230,7 +230,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses)
 		spin_lock(&ses->iface_lock);
 		if (!ses->iface_count) {
 			spin_unlock(&ses->iface_lock);
-			cifs_dbg(VFS, "server %s does not advertise interfaces\n",
+			cifs_dbg(ONCE, "server %s does not advertise interfaces\n",
 				      ses->server->hostname);
 			break;
 		}
@@ -396,7 +396,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
 	spin_lock(&ses->iface_lock);
 	if (!ses->iface_count) {
 		spin_unlock(&ses->iface_lock);
-		cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname);
+		cifs_dbg(ONCE, "server %s does not advertise interfaces\n", ses->server->hostname);
 		return;
 	}
 
Signature · 1 line
2.40.1