Commit 61cabc7b authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French

cifs: fix GlobalMid_Lock bug in cifs_reconnect

We can not hold the GlobalMid_Lock spinlock during the
dfs processing in cifs_reconnect since it invokes things that may sleep
and thus trigger :

BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23

Thus we need to drop the spinlock during this code block.

RHBZ: 1716743

Cc: stable@vger.kernel.org
Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Acked-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 8d526d62
...@@ -476,6 +476,7 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -476,6 +476,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
server->nr_targets = 1; server->nr_targets = 1;
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
spin_unlock(&GlobalMid_Lock);
cifs_sb = find_super_by_tcp(server); cifs_sb = find_super_by_tcp(server);
if (IS_ERR(cifs_sb)) { if (IS_ERR(cifs_sb)) {
rc = PTR_ERR(cifs_sb); rc = PTR_ERR(cifs_sb);
...@@ -493,6 +494,7 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -493,6 +494,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
} }
cifs_dbg(FYI, "%s: will retry %d target(s)\n", __func__, cifs_dbg(FYI, "%s: will retry %d target(s)\n", __func__,
server->nr_targets); server->nr_targets);
spin_lock(&GlobalMid_Lock);
#endif #endif
if (server->tcpStatus == CifsExiting) { if (server->tcpStatus == CifsExiting) {
/* the demux thread will exit normally /* the demux thread will exit normally
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment