Commit 687127c8 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French
Browse files

cifs: fix potential race with cifsd thread



To avoid racing with demultiplex thread while it is handling data on
socket, use cifs_signal_cifsd_for_reconnect() helper for marking
current server to reconnect and let the demultiplex thread handle the
rest.

Fixes: dca65818 ("cifs: use a different reconnect helper for non-cifsd threads")
Reviewed-by: default avatarEnzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 31231092
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -4465,7 +4465,7 @@ static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
	 */
	 */
	if (rc && server->current_fullpath != server->origin_fullpath) {
	if (rc && server->current_fullpath != server->origin_fullpath) {
		server->current_fullpath = server->origin_fullpath;
		server->current_fullpath = server->origin_fullpath;
		cifs_reconnect(tcon->ses->server, true);
		cifs_signal_cifsd_for_reconnect(server, true);
	}
	}


	dfs_cache_free_tgts(tl);
	dfs_cache_free_tgts(tl);
+1 −1
Original line number Original line Diff line number Diff line
@@ -896,7 +896,7 @@ map_and_check_smb_error(struct mid_q_entry *mid, bool logErr)
		if (class == ERRSRV && code == ERRbaduid) {
		if (class == ERRSRV && code == ERRbaduid) {
			cifs_dbg(FYI, "Server returned 0x%x, reconnecting session...\n",
			cifs_dbg(FYI, "Server returned 0x%x, reconnecting session...\n",
				code);
				code);
			cifs_reconnect(mid->server, false);
			cifs_signal_cifsd_for_reconnect(mid->server, false);
		}
		}
	}
	}