All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: CIFS <linux-cifs@vger.kernel.org>,
	 samba-technical <samba-technical@lists.samba.org>
Subject: Re: [PATCH][smb3 client] allow debugging session and tcon info to improve stats analysis and debugging
Date: Sun, 12 Nov 2023 12:21:53 -0600	[thread overview]
Message-ID: <CAH2r5mujJjTaOU8YrpZEPamoW3fSLTVkNk-L9bAmCqBAAxckdg@mail.gmail.com> (raw)
In-Reply-To: <CAH2r5mugOefduw_pgpYCZtHPiuosSQrcOKb0MFcv8v7giEopMA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 767 bytes --]

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

# 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
-- 
Thanks,

Steve

[-- Attachment #1.2: Type: text/html, Size: 1035 bytes --]

[-- Attachment #2: get-tcon-inf.c --]
[-- Type: text/x-csrc, Size: 811 bytes --]

#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);
	}
}




      reply	other threads:[~2023-11-12 18:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 21:51 [PATCH][smb3 client] allow debugging session and tcon info to improve stats analysis and debugging Steve French
2023-11-10  2:51 ` Steve French
2023-11-10  4:19   ` Shyam Prasad N
2023-11-10  7:09   ` Steve French
2023-11-12 18:21     ` Steve French [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH2r5mujJjTaOU8YrpZEPamoW3fSLTVkNk-L9bAmCqBAAxckdg@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.