cifs: fix GlobalMid_Lock bug in cifs_reconnect
Subsystems (3)
PATCH 1/1 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
--- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/connect.c +2 -0
@@ -476,6 +476,7 @@ cifs_reconnect(struct TCP_Server_Info *server)spin_lock (&GlobalMid_Lock); server->nr_targets =1 ;#ifdef CONFIG_CIFS_DFS_UPCALL +spin_unlock (&GlobalMid_Lock); cifs_sb =find_super_by_tcp (server);if (IS_ERR (cifs_sb)) { rc =PTR_ERR (cifs_sb);
@@ -493,6 +494,7 @@ cifs_reconnect(struct TCP_Server_Info *server) }cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, server->nr_targets); +spin_lock (&GlobalMid_Lock);#endif if (server->tcpStatus == CifsExiting) {/* the demux thread will exit normally
Signature · 1 line
2.13.6
tentatively merged into cifs-2.6.git for-next and to the github tree
Quoted 40 lines · Ronnie Sahlberg
We can not hold the
GlobalMid_Lockspinlock during the
dfs processing incifs_reconnectsince it invokes things that may sleep and thus trigger :BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23Thus we need to drop the spinlock during this code block.
RHBZ: 1716743
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+)fs/cifs/connect.c +2
-1@@ -476,6 +476,7 @@ cifs_reconnect(struct TCP_Server_Info *server)spin_lock (&GlobalMid_Lock); server->nr_targets =1 ;#ifdef CONFIG_CIFS_DFS_UPCALL +spin_unlock (&GlobalMid_Lock); cifs_sb =find_super_by_tcp (server);if (IS_ERR (cifs_sb)) { rc =PTR_ERR (cifs_sb);@@ -493,6 +494,7 @@ cifs_reconnect(struct TCP_Server_Info *server) }cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, server->nr_targets); +spin_lock (&GlobalMid_Lock);#endif if (server->tcpStatus == CifsExiting) {/* the demux thread will exit normally -- 2.13.6
Signature · 3 lines
Thanks, Steve
Pavel Shilovsky
Acked-by--
Best regards,
Pavel Shilovsky
чт, 13 июн. 2019 г. в 20:57, Steve French <[email protected]>:
Quoted 50 lines
tentatively merged into cifs-2.6.git for-next and to the github tree
Quoted 38 lines · Ronnie Sahlberg
We can not hold the
GlobalMid_Lockspinlock during the
dfs processing incifs_reconnectsince it invokes things that may sleep and thus trigger :BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23Thus we need to drop the spinlock during this code block.
RHBZ: 1716743
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+)fs/cifs/connect.c +2
-1@@ -476,6 +476,7 @@ cifs_reconnect(struct TCP_Server_Info *server)spin_lock (&GlobalMid_Lock); server->nr_targets =1 ;#ifdef CONFIG_CIFS_DFS_UPCALL +spin_unlock (&GlobalMid_Lock); cifs_sb =find_super_by_tcp (server);if (IS_ERR (cifs_sb)) { rc =PTR_ERR (cifs_sb);@@ -493,6 +494,7 @@ cifs_reconnect(struct TCP_Server_Info *server) }cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, server->nr_targets); +spin_lock (&GlobalMid_Lock);#endif if (server->tcpStatus == CifsExiting) {/* the demux thread will exit normally -- Quoted 2 lines
2.13.6
--
Thanks,Steve