Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/6] cifs: fix status checks in cifs_tree_connect
@ 2023-06-09 17:46 Shyam Prasad N
  2023-06-09 17:46 ` [PATCH 2/6] cifs: print all credit counters in DebugData Shyam Prasad N
                   ` (5 more replies)
  0 siblings, 6 replies; 37+ messages in thread
From: Shyam Prasad N @ 2023-06-09 17:46 UTC (permalink / raw)
  To: linux-cifs, smfrench, pc, bharathsm.hsk, tom; +Cc: Shyam Prasad N

The ordering of status checks at the beginning of
cifs_tree_connect is wrong. As a result, a tcon
which is good may stay marked as needing reconnect
infinitely.

Fixes: 2f0e4f034220 ("cifs: check only tcon status on tcon related functions")
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/smb/client/connect.c | 9 +++++----
 fs/smb/client/dfs.c     | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 8e9a672320ab..1250d156619b 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -4086,16 +4086,17 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
 
 	/* only send once per connect */
 	spin_lock(&tcon->tc_lock);
+	if (tcon->status == TID_GOOD) {
+		spin_unlock(&tcon->tc_lock);
+		return 0;
+	}
+
 	if (tcon->status != TID_NEW &&
 	    tcon->status != TID_NEED_TCON) {
 		spin_unlock(&tcon->tc_lock);
 		return -EHOSTDOWN;
 	}
 
-	if (tcon->status == TID_GOOD) {
-		spin_unlock(&tcon->tc_lock);
-		return 0;
-	}
 	tcon->status = TID_IN_TCON;
 	spin_unlock(&tcon->tc_lock);
 
diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index 2f93bf8c3325..2390b2fedd6a 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -575,16 +575,17 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
 
 	/* only send once per connect */
 	spin_lock(&tcon->tc_lock);
+	if (tcon->status == TID_GOOD) {
+		spin_unlock(&tcon->tc_lock);
+		return 0;
+	}
+
 	if (tcon->status != TID_NEW &&
 	    tcon->status != TID_NEED_TCON) {
 		spin_unlock(&tcon->tc_lock);
 		return -EHOSTDOWN;
 	}
 
-	if (tcon->status == TID_GOOD) {
-		spin_unlock(&tcon->tc_lock);
-		return 0;
-	}
 	tcon->status = TID_IN_TCON;
 	spin_unlock(&tcon->tc_lock);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-06-29 15:35 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 17:46 [PATCH 1/6] cifs: fix status checks in cifs_tree_connect Shyam Prasad N
2023-06-09 17:46 ` [PATCH 2/6] cifs: print all credit counters in DebugData Shyam Prasad N
2023-06-10 19:48   ` Steve French
2023-06-09 17:46 ` [PATCH 3/6] cifs: add a warning when the in-flight count goes negative Shyam Prasad N
2023-06-10 19:49   ` Steve French
2023-06-11  8:01     ` Shyam Prasad N
2023-06-23 16:22       ` Tom Talpey
2023-06-26  6:33         ` Shyam Prasad N
2023-06-27 19:40           ` Tom Talpey
2023-06-09 17:46 ` [PATCH 4/6] cifs: display the endpoint IP details in DebugData Shyam Prasad N
2023-06-09 18:02   ` Enzo Matsumiya
2023-06-11  8:02     ` Shyam Prasad N
2023-06-12  7:59       ` Shyam Prasad N
2023-06-12  7:59         ` Shyam Prasad N
2023-06-12 14:03           ` Enzo Matsumiya
2023-06-12 13:52         ` Enzo Matsumiya
2023-06-12 15:25         ` Paulo Alcantara
2023-06-12 15:29           ` Enzo Matsumiya
2023-06-23  4:21             ` Shyam Prasad N
2023-06-23 15:51               ` Steve French
2023-06-23 15:54               ` Tom Talpey
2023-06-27 12:17                 ` Shyam Prasad N
2023-06-28 10:20                   ` Shyam Prasad N
2023-06-28 13:39                     ` Tom Talpey
2023-06-28 16:24                       ` Steve French
2023-06-28 16:51                     ` Steve French
2023-06-28 17:07                     ` Steve French
2023-06-28 17:11                     ` Steve French
2023-06-29 15:35                       ` Shyam Prasad N
2023-06-09 17:46 ` [PATCH 5/6] cifs: fix max_credits implementation Shyam Prasad N
2023-06-23 16:00   ` Tom Talpey
2023-06-26  5:40     ` Shyam Prasad N
2023-06-09 17:46 ` [PATCH 6/6] cifs: fix sockaddr comparison in iface_cmp Shyam Prasad N
2023-06-23 16:09   ` Tom Talpey
2023-06-26 11:12     ` Dan Carpenter
2023-06-27 19:37       ` Tom Talpey
2023-06-10 19:45 ` [PATCH 1/6] cifs: fix status checks in cifs_tree_connect Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox