smb: client: add mid_counter_lock to protect the mid counter counter
authorWang Zhaolong <wangzhaolong@huaweicloud.com>
Mon, 4 Aug 2025 13:40:04 +0000 (21:40 +0800)
committerSteve French <stfrench@microsoft.com>
Tue, 5 Aug 2025 16:29:00 +0000 (11:29 -0500)
commit9bd42798d5bf87f56d229a27e40140df95ef743d
treec12418527b0a7045471b3cee1f97ffb5b5978959
parentf3ba7c9b0421e3935998334a860bd88f2ffdb18e
smb: client: add mid_counter_lock to protect the mid counter counter

This is step 2/4 of a patch series to fix mid_q_entry memory leaks
caused by race conditions in callback execution.

Add a dedicated mid_counter_lock to protect current_mid counter,
separating it from mid_queue_lock which protects pending_mid_q
operations. This reduces lock contention and prepares for finer-
grained locking in subsequent patches.

Changes:
- Add TCP_Server_Info->mid_counter_lock spinlock
- Rename CurrentMid to current_mid for consistency
- Use mid_counter_lock to protect current_mid access
- Update locking documentation in cifsglob.h

This separation allows mid allocation to proceed without blocking
queue operations, improving performance under heavy load.

Signed-off-by: Wang Zhaolong <wangzhaolong@huaweicloud.com>
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsglob.h
fs/smb/client/connect.c
fs/smb/client/smb1ops.c
fs/smb/client/smb2ops.c
fs/smb/client/transport.c