mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
cifs: fix status checks in cifs_tree_connect
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: 2f0e4f0342
("cifs: check only tcon status on tcon related functions")
Cc: stable@vger.kernel.org # 6.3
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
a5998a9ec3
commit
91f4480c41
2 changed files with 10 additions and 8 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue