Attached is a sample program (that uses the new cifs.ko IOCTL) to dump the tree id for a mount to make it easier to look at traces, wireshark, /proc/fs/cifs/Stats, /proc/fs/cifs/DebugData if you have more than one mount (would be useful to add something similar to debugging tools and/or smb-info or something new in cifs-utils).
e.g.
# ./get-tcon-inf /mnt2
ioctl completed. tid 0x47b3d0e2 session id: 0xf6cde60a
ioctl completed. tid 0x47b3d0e2 session id: 0xf6cde60a
# cat /proc/fs/cifs/DebugData | grep "tid: 0x47b3d0e2" -C3
2) \\localhost\test Mounts: 1 DevInfo: 0x20 Attributes: 0x801007f
PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xaab31952
Share Capabilities: None Aligned, Partition Aligned, Share Flags: 0x0
tid: 0x47b3d0e2 Optimal sector size: 0x200 Maximal Access: 0x1f01ff
-- 2) \\localhost\test Mounts: 1 DevInfo: 0x20 Attributes: 0x801007f
PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0xaab31952
Share Capabilities: None Aligned, Partition Aligned, Share Flags: 0x0
tid: 0x47b3d0e2 Optimal sector size: 0x200 Maximal Access: 0x1f01ff
Thanks,
Steve
Steve
#include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <stdbool.h> #include <fcntl.h> #include <string.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> struct __attribute__((__packed__))smb_mnt_tcon_info { uint32_t tid; uint64_t session_id; } __packed; #define CIFS_IOC_GET_TCON_INFO 0x800ccf0c int main(int argc, char **argv) { struct smb_mnt_tcon_info mnt_info; int f; if ((f = open(argv[1], O_RDONLY)) < 0) { fprintf(stderr, "Failed to open %s\n", argv[1]); exit(1); } if (ioctl(f, CIFS_IOC_GET_TCON_INFO, &mnt_info) < 0) printf("Error %d returned from ioctl\n", errno); else { printf("ioctl completed. tid 0x%x session id: 0x%lx\n", mnt_info.tid, mnt_info.session_id); } }