summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorGordon Ross <gwr@racktopsystems.com>2022-02-05 11:54:38 -0500
committerGordon Ross <gwr@racktopsystems.com>2022-02-15 18:46:43 -0500
commit4d723c3fe851d72cc2dc241f5a1777f9e3e85b87 (patch)
tree01041dff551ef028993bb6d2817548d1fdf4e5f4 /usr/src
parent0a34963c38fe21eee84ebab010996317731a5171 (diff)
downloadillumos-joyent-4d723c3fe851d72cc2dc241f5a1777f9e3e85b87.tar.gz
14479 SMB testoplock broken after 13515
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Matt Barden <mbarden@tintri.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/smbsrv/testoplock/Makefile3
-rw-r--r--usr/src/cmd/smbsrv/testoplock/tol_main.c17
2 files changed, 19 insertions, 1 deletions
diff --git a/usr/src/cmd/smbsrv/testoplock/Makefile b/usr/src/cmd/smbsrv/testoplock/Makefile
index 12fcbd0ac9..74f3d93d4c 100644
--- a/usr/src/cmd/smbsrv/testoplock/Makefile
+++ b/usr/src/cmd/smbsrv/testoplock/Makefile
@@ -21,6 +21,7 @@
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2018 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2022 RackTop Systems, Inc.
#
@@ -65,7 +66,7 @@ CPPFLAGS += -DDEBUG
CPPFLAGS += $(INCS)
LDFLAGS += $(ZNOLAZYLOAD)
-LDFLAGS += '-R$$ORIGIN/..'
+LDFLAGS += '-R$$ORIGIN/..' '-R$$ORIGIN/../../../lib'
LDLIBS += -lfakekernel -lcmdutils
LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
diff --git a/usr/src/cmd/smbsrv/testoplock/tol_main.c b/usr/src/cmd/smbsrv/testoplock/tol_main.c
index 126f3a17f5..5382802b82 100644
--- a/usr/src/cmd/smbsrv/testoplock/tol_main.c
+++ b/usr/src/cmd/smbsrv/testoplock/tol_main.c
@@ -12,6 +12,7 @@
/*
* Copyright 2018 Nexenta Systems, Inc. All rights reserved.
* Copyright 2019 Joyent, Inc.
+ * Copyright 2022 RackTop Systems, Inc.
*/
/*
@@ -190,10 +191,18 @@ do_close(int fid)
printf(" close fid %d already closed\n");
return;
}
+
+ smb_llist_enter(&node->n_ofile_list, RW_READER);
+ mutex_enter(&node->n_oplock.ol_mutex);
+
smb_oplock_break_CLOSE(ofile->f_node, ofile);
smb_llist_remove(&node->n_ofile_list, ofile);
node->n_open_count--;
+
+ mutex_exit(&node->n_oplock.ol_mutex);
+ smb_llist_exit(&node->n_ofile_list);
+
ofile->f_refcnt--;
bzero(ofile->TargetOplockKey, SMB_LEASE_KEY_SZ);
@@ -331,6 +340,7 @@ do_brk_setinfo(int fid, char *arg2)
static void
do_move(int fid, char *arg2)
{
+ smb_node_t *node = &test_node;
smb_ofile_t *ofile = &ofile_array[fid];
smb_ofile_t *of2;
int fid2;
@@ -346,7 +356,12 @@ do_move(int fid, char *arg2)
}
of2 = &ofile_array[fid2];
+ mutex_enter(&node->n_oplock.ol_mutex);
+
smb_oplock_move(&test_node, ofile, of2);
+
+ mutex_exit(&node->n_oplock.ol_mutex);
+
printf(" move %d %d\n", fid, fid2);
}
@@ -384,6 +399,8 @@ main(int argc, char *argv[])
if (isatty(0))
prompt = "> ";
+ mutex_init(&node->n_mutex, NULL, MUTEX_DEFAULT, NULL);
+
smb_llist_constructor(&node->n_ofile_list, sizeof (smb_ofile_t),
offsetof(smb_ofile_t, f_node_lnd));