1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

cifs: check only tcon status on tcon related functions

We had a couple of checks for session in cifs_tree_connect
and cifs_mark_open_files_invalid, which were unnecessary.
And that was done with ses_lock. Changed that to tc_lock too.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Shyam Prasad N 2023-03-16 10:45:12 +00:00 committed by Steve French
parent 38e04b3e42
commit 2f0e4f0342
4 changed files with 19 additions and 11 deletions

View file

@ -4036,9 +4036,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */ /* only send once per connect */
spin_lock(&tcon->tc_lock); spin_lock(&tcon->tc_lock);
if (tcon->ses->ses_status != SES_GOOD || if (tcon->status != TID_NEW &&
(tcon->status != TID_NEW && tcon->status != TID_NEED_TCON) {
tcon->status != TID_NEED_TCON)) { spin_unlock(&tcon->tc_lock);
return -EHOSTDOWN;
}
if (tcon->status == TID_GOOD) {
spin_unlock(&tcon->tc_lock); spin_unlock(&tcon->tc_lock);
return 0; return 0;
} }

View file

@ -502,9 +502,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */ /* only send once per connect */
spin_lock(&tcon->tc_lock); spin_lock(&tcon->tc_lock);
if (tcon->ses->ses_status != SES_GOOD || if (tcon->status != TID_NEW &&
(tcon->status != TID_NEW && tcon->status != TID_NEED_TCON) {
tcon->status != TID_NEED_TCON)) { spin_unlock(&tcon->tc_lock);
return -EHOSTDOWN;
}
if (tcon->status == TID_GOOD) {
spin_unlock(&tcon->tc_lock); spin_unlock(&tcon->tc_lock);
return 0; return 0;
} }

View file

@ -1191,7 +1191,7 @@ static int __refresh_tcon(const char *path, struct cifs_tcon *tcon, bool force_r
} }
spin_lock(&ipc->tc_lock); spin_lock(&ipc->tc_lock);
if (ses->ses_status != SES_GOOD || ipc->status != TID_GOOD) { if (ipc->status != TID_GOOD) {
spin_unlock(&ipc->tc_lock); spin_unlock(&ipc->tc_lock);
cifs_dbg(FYI, "%s: skip cache refresh due to disconnected ipc\n", __func__); cifs_dbg(FYI, "%s: skip cache refresh due to disconnected ipc\n", __func__);
goto out; goto out;

View file

@ -174,13 +174,13 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
struct list_head *tmp1; struct list_head *tmp1;
/* only send once per connect */ /* only send once per connect */
spin_lock(&tcon->ses->ses_lock); spin_lock(&tcon->tc_lock);
if ((tcon->ses->ses_status != SES_GOOD) || (tcon->status != TID_NEED_RECON)) { if (tcon->status != TID_NEED_RECON) {
spin_unlock(&tcon->ses->ses_lock); spin_unlock(&tcon->tc_lock);
return; return;
} }
tcon->status = TID_IN_FILES_INVALIDATE; tcon->status = TID_IN_FILES_INVALIDATE;
spin_unlock(&tcon->ses->ses_lock); spin_unlock(&tcon->tc_lock);
/* list all files open on tree connection and mark them invalid */ /* list all files open on tree connection and mark them invalid */
spin_lock(&tcon->open_file_lock); spin_lock(&tcon->open_file_lock);