Re: [PATCH 12/14] cifs: handle when server stops supporting multichannel

Paulo Alcantara
2023-11-08T16:35:08Z

nspmangalore@gmail.com writes:

> From: Shyam Prasad N <sprasad@microsoft.com>
>
> When a server stops supporting multichannel, we will
> keep attempting reconnects to the secondary channels today.
> Avoid this by freeing extra channels when negotiate
> returns no multichannel support.
>
> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> ---
> fs/smb/client/cifsglob.h | 1 +
> fs/smb/client/cifsproto.h | 2 ++
> fs/smb/client/connect.c | 10 ++++++
> fs/smb/client/sess.c | 64 ++++++++++++++++++++++++++++++-----
> fs/smb/client/smb2pdu.c | 70 ++++++++++++++++++++++++++++++++++++++-
> fs/smb/client/transport.c | 2 +-
> 6 files changed, 139 insertions(+), 10 deletions(-)

Several reconnect tests are triggering this when running against
for-next branch

[ 360.487827] dftest>> [*] mount opts: vers=3.1.1,echo_interval=10,nohandlecache,noserverino
[ 361.570676] dftest>> [*] mount opts: vers=3.1.1,echo_interval=10,nohandlecache,noserverino
[ 361.572133] dftest>> [*] TEST: mount //gandalf.test/dfstest3 , cd /mnt/dfs/link , ls ., expect:["target\d_file" "tsub"]
[ 361.572133] disconnect /mnt/dfs/link , ls#1 . (fail here is ok), ls#2 (fail here NOT ok)
[ 361.613964] CIFS: Attempting to mount //gandalf.test/dfstest3
[ 361.637663] virtio_net virtio1 enp1s0: entered promiscuous mode
[ 362.262990] CIFS: Attempting to mount //gandalf.test/dfstest3/link
[ 362.483166] ls (978) used greatest stack depth: 21904 bytes left
[ 398.362399] CIFS: VFS: \\w22-root2.gandalf.test has not responded in 30 seconds. Reconnecting...
[ 398.364632] BUG: sleeping function called from invalid context at kernel/workqueue.c:3344
[ 398.366399] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 981, name: cifsd
[ 398.367318] preempt_count: 1, expected: 0
[ 398.367826] RCU nest depth: 0, expected: 0
[ 398.368414] 1 lock held by cifsd/981:
[ 398.368905] #0: ffffffffc028fb58 (&cifs_tcp_ses_lock){+.+.}-{2:2}, at: cifs_mark_tcp_ses_conns_for_reconnect+0x5f/0x3b0 [cifs]
[ 398.371053] CPU: 3 PID: 981 Comm: cifsd Not tainted 6.6.0 #1
[ 398.371720] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
[ 398.373072] Call Trace:
[ 398.373404] <TASK>
[ 398.373700] dump_stack_lvl+0x64/0x80
[ 398.374188] __might_resched+0x23c/0x360
[ 398.374708] ? __pfx___might_resched+0x10/0x10
[ 398.375188] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.375688] ? __might_sleep+0x2b/0xb0
[ 398.376086] ? __flush_work+0xc5/0x640
[ 398.376539] __flush_work+0xfd/0x640
[ 398.377019] ? __flush_work+0xc5/0x640
[ 398.377524] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.378155] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.378798] ? __pfx___flush_work+0x10/0x10
[ 398.379408] ? hlock_class+0x32/0xc0
[ 398.379840] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.380355] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.380959] ? mark_held_locks+0x5d/0x90
[ 398.381537] __cancel_work_timer+0x210/0x2c0
[ 398.382117] ? __pfx___cancel_work_timer+0x10/0x10
[ 398.382757] ? do_raw_spin_trylock+0xd1/0x120
[ 398.383363] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.383921] ? do_raw_spin_unlock+0x9b/0x100
[ 398.384382] cifs_mark_tcp_ses_conns_for_reconnect+0x227/0x3b0 [cifs]
[ 398.385834] reconnect_dfs_server+0x162/0x6b0 [cifs]
[ 398.387107] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.387715] ? __mutex_unlock_slowpath+0x11e/0x400
[ 398.388219] ? __pfx___mutex_lock+0x10/0x10
[ 398.388736] ? __pfx_reconnect_dfs_server+0x10/0x10 [cifs]
[ 398.390057] ? __pfx____ratelimit+0x10/0x10
[ 398.390637] cifs_readv_from_socket+0x335/0x490 [cifs]
[ 398.391898] ? __pfx_cifs_readv_from_socket+0x10/0x10 [cifs]
[ 398.393084] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.393730] cifs_read_from_socket+0xb5/0x100 [cifs]
[ 398.394985] ? __pfx_cifs_read_from_socket+0x10/0x10 [cifs]
[ 398.396176] ? __pfx_mempool_alloc+0x10/0x10
[ 398.396734] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.397386] ? cifs_small_buf_get+0x53/0x70 [cifs]
[ 398.398619] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.399245] ? allocate_buffers+0xa7/0x1d0 [cifs]
[ 398.400294] cifs_demultiplex_thread+0x274/0x1270 [cifs]
[ 398.401346] ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
[ 398.402680] ? __pfx_lock_release+0x10/0x10
[ 398.403053] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.403464] ? mark_held_locks+0x1a/0x90
[ 398.403813] ? lockdep_hardirqs_on_prepare+0x136/0x210
[ 398.404250] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.404663] ? srso_alias_return_thunk+0x5/0xfbef5
[ 398.405079] ? __kthread_parkme+0xce/0xf0
[ 398.405433] ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
[ 398.406293] kthread+0x18d/0x1d0
[ 398.406582] ? kthread+0xdb/0x1d0
[ 398.406885] ? __pfx_kthread+0x10/0x10
[ 398.407237] ret_from_fork+0x34/0x60
[ 398.407551] ? __pfx_kthread+0x10/0x10
[ 398.407881] ret_from_fork_asm+0x1b/0x30
[ 398.408258] </TASK>