mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08: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
@ -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…
Reference in New Issue
Block a user