summaryrefslogtreecommitdiff
path: root/usr/src/cmd/smbsrv
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2019-09-11 17:12:06 -0400
committerGordon Ross <gordon.w.ross@gmail.com>2022-01-24 08:07:18 -0500
commit1c53c56f27c8091f8066fb65aceeca8ee8b6df7a (patch)
tree46931bde73a4d60859d718d2eabbe08076f3bf0b /usr/src/cmd/smbsrv
parent49a4bc70cea348bb81385206be344cf03f3d2b7c (diff)
downloadillumos-joyent-1c53c56f27c8091f8066fb65aceeca8ee8b6df7a.tar.gz
14095 Dtrace probes for nbmand conflict identification
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com> Reviewed by: Evan Layton <evan.layton@nexenta.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr/src/cmd/smbsrv')
-rw-r--r--usr/src/cmd/smbsrv/dtrace/Makefile3
-rw-r--r--usr/src/cmd/smbsrv/dtrace/nbl-conflict.d56
2 files changed, 58 insertions, 1 deletions
diff --git a/usr/src/cmd/smbsrv/dtrace/Makefile b/usr/src/cmd/smbsrv/dtrace/Makefile
index 0ed2c858af..cf25f9c735 100644
--- a/usr/src/cmd/smbsrv/dtrace/Makefile
+++ b/usr/src/cmd/smbsrv/dtrace/Makefile
@@ -26,7 +26,8 @@
#
SRCS= smbd-all.d smbd-authsvc.d smbd-doorsvc.d smbd-pipesvc.d \
- smbnode.d smbsrv.d smbvfs.d smb-trace.d smb2-trace.d
+ smbnode.d smbsrv.d smbvfs.d smb-trace.d smb2-trace.d \
+ nbl-conflict.d
include ../../Makefile.cmd
diff --git a/usr/src/cmd/smbsrv/dtrace/nbl-conflict.d b/usr/src/cmd/smbsrv/dtrace/nbl-conflict.d
new file mode 100644
index 0000000000..da66f76679
--- /dev/null
+++ b/usr/src/cmd/smbsrv/dtrace/nbl-conflict.d
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
+ */
+
+/*
+ * This dtrace script shows how to track down the owners of locks
+ * that prevent I/O in filesystems with mandatory locking enabled
+ * (eg. ZFS with nbmand=on). This script is not in any way specific
+ * to SMB, but this problem is most often seen when SMB is in use
+ * because SMB requires mandatory locking semantics.
+ *
+ * Run this script, eg. dtrace -s nbl-conflict.d
+ * taking note of these fields in the dtrace output:
+ * conflict_lock: .l_sysid .l_pid
+ * conflict_shrlock: .s_sysid .s_pid
+ *
+ * The sysid values tell you if a local or remote owner has the
+ * lock or share preventing I/O, and the pid tells which process.
+ */
+
+sdt::nbl_lock_conflict:conflict_lock
+{
+ this->lock = (lock_descriptor_t *)arg0;
+ print(this->lock->l_flock);
+}
+
+sdt::nbl_share_conflict:conflict_shrlock
+{
+ this->shrl = (struct shrlock *)arg0;
+ print(*(this->shrl));
+}
+
+/*
+ * The above probe action in nbl_share_conflict shows conflicts
+ * with read/write operations (eg. from the NFS server).
+ * This probe action shows share reservation conflicts at open.
+ * (Remove this if you're only interested in I/O conflicts.)
+ */
+sdt::add_share:conflict_shrlock
+{
+ this->shrl = (struct shrlock *)arg0;
+ print(*(this->shrl));
+}