Patch "smb3: allow dumping session and tcon id to improve stats analysis and debugging" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    smb3: allow dumping session and tcon id to improve stats analysis and debugging

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     smb3-allow-dumping-session-and-tcon-id-to-improve-stats-analysis-and-debugging.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From de4eceab578ead12a71e5b5588a57e142bbe8ceb Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Thu, 9 Nov 2023 15:28:12 -0600
Subject: smb3: allow dumping session and tcon id to improve stats analysis and debugging

From: Steve French <stfrench@xxxxxxxxxxxxx>

commit de4eceab578ead12a71e5b5588a57e142bbe8ceb upstream.

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@xxxxxxxxxxxxxxx
Reviewed-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/smb/client/cifs_ioctl.h |    6 ++++++
 fs/smb/client/ioctl.c      |   25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

--- a/fs/smb/client/cifs_ioctl.h
+++ b/fs/smb/client/cifs_ioctl.h
@@ -26,6 +26,11 @@ struct smb_mnt_fs_info {
 	__u64   cifs_posix_caps;
 } __packed;
 
+struct smb_mnt_tcon_info {
+	__u32	tid;
+	__u64	session_id;
+} __packed;
+
 struct smb_snapshot_array {
 	__u32	number_of_snapshots;
 	__u32	number_of_snapshots_returned;
@@ -108,6 +113,7 @@ struct smb3_notify_info {
 #define CIFS_IOC_NOTIFY _IOW(CIFS_IOCTL_MAGIC, 9, struct smb3_notify)
 #define CIFS_DUMP_FULL_KEY _IOWR(CIFS_IOCTL_MAGIC, 10, struct smb3_full_key_debug_info)
 #define CIFS_IOC_NOTIFY_INFO _IOWR(CIFS_IOCTL_MAGIC, 11, struct smb3_notify_info)
+#define CIFS_IOC_GET_TCON_INFO _IOR(CIFS_IOCTL_MAGIC, 12, struct smb_mnt_tcon_info)
 #define CIFS_IOC_SHUTDOWN _IOR('X', 125, __u32)
 
 /*
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -117,6 +117,20 @@ out_drop_write:
 	return rc;
 }
 
+static long smb_mnt_get_tcon_info(struct cifs_tcon *tcon, void __user *arg)
+{
+	int rc = 0;
+	struct smb_mnt_tcon_info tcon_inf;
+
+	tcon_inf.tid = tcon->tid;
+	tcon_inf.session_id = tcon->ses->Suid;
+
+	if (copy_to_user(arg, &tcon_inf, sizeof(struct smb_mnt_tcon_info)))
+		rc = -EFAULT;
+
+	return rc;
+}
+
 static long smb_mnt_get_fsinfo(unsigned int xid, struct cifs_tcon *tcon,
 				void __user *arg)
 {
@@ -414,6 +428,17 @@ long cifs_ioctl(struct file *filep, unsi
 			tcon = tlink_tcon(pSMBFile->tlink);
 			rc = smb_mnt_get_fsinfo(xid, tcon, (void __user *)arg);
 			break;
+		case CIFS_IOC_GET_TCON_INFO:
+			cifs_sb = CIFS_SB(inode->i_sb);
+			tlink = cifs_sb_tlink(cifs_sb);
+			if (IS_ERR(tlink)) {
+				rc = PTR_ERR(tlink);
+				break;
+			}
+			tcon = tlink_tcon(tlink);
+			rc = smb_mnt_get_tcon_info(tcon, (void __user *)arg);
+			cifs_put_tlink(tlink);
+			break;
 		case CIFS_ENUMERATE_SNAPSHOTS:
 			if (pSMBFile == NULL)
 				break;


Patches currently in stable-queue which might be from stfrench@xxxxxxxxxxxxx are

queue-6.6/smb3-fix-caching-of-ctime-on-setxattr.patch
queue-6.6/cifs-spnego-add-in-host_key_len.patch
queue-6.6/ksmbd-handle-malformed-smb1-message.patch
queue-6.6/cifs-reconnect-helper-should-set-reconnect-for-the-right-channel.patch
queue-6.6/smb3-fix-touch-h-of-symlink.patch
queue-6.6/ksmbd-fix-recursive-locking-in-vfs-helpers.patch
queue-6.6/cifs-do-not-reset-chan_max-if-multichannel-is-not-supported-at-mount.patch
queue-6.6/smb3-fix-creating-fifos-when-mounting-with-sfu-mount-option.patch
queue-6.6/cifs-fix-check-of-rc-in-function-generate_smb3signin.patch
queue-6.6/smb3-allow-dumping-session-and-tcon-id-to-improve-stats-analysis-and-debugging.patch
queue-6.6/smb-client-fix-use-after-free-bug-in-cifs_debug_data_proc_show.patch
queue-6.6/cifs-force-interface-update-before-a-fresh-session-setup.patch
queue-6.6/smb-client-fix-potential-deadlock-when-releasing-mids.patch
queue-6.6/smb-client-fix-use-after-free-in-smb2_query_info_compound.patch
queue-6.6/cifs-do-not-pass-cifs_sb-when-trying-to-add-channels.patch
queue-6.6/smb-client-fix-mount-when-dns_resolver-key-is-not-available.patch
queue-6.6/ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_dacl.patch
queue-6.6/cifs-fix-encryption-of-cleared-but-unset-rq_iter-data-buffers.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux