smb3: allow dumping session and tcon id to improve stats analysis and debugging
authorSteve French <stfrench@microsoft.com>
Thu, 9 Nov 2023 21:28:12 +0000 (15:28 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 06:32:09 +0000 (07:32 +0100)
commitf4dff371119b5e41d092f37d606a58437400aaed
treeb0ce5222ec3203da6636847bebe2f7deae787cbc
parentfbc666a9ac5af6adb94e4e63da8ff5d334d81bec
smb3: allow dumping session and tcon id to improve stats analysis and debugging

[ Upstream commit de4eceab578ead12a71e5b5588a57e142bbe8ceb ]

When multiple mounts are to the same share from the same client it was not
possible to determine which section of /proc/fs/cifs/Stats (and DebugData)
correspond to that mount.  In some recent examples this turned out to  be
a significant problem when trying to analyze performance data - since
there are many cases where unless we know the tree id and session id we
can't figure out which stats (e.g. number of SMB3.1.1 requests by type,
the total time they take, which is slowest, how many fail etc.) apply to
which mount. The only existing loosely related ioctl CIFS_IOC_GET_MNT_INFO
does not return the information needed to uniquely identify which tcon
is which mount although it does return various flags and device info.

Add a cifs.ko ioctl CIFS_IOC_GET_TCON_INFO (0x800ccf0c) to return tid,
session id, tree connect count.

Cc: stable@vger.kernel.org
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/cifs_ioctl.h
fs/smb/client/ioctl.c