[PATCH] Part 1 for flapping notify tests

Jeremy Allison jra at samba.org
Fri Aug 31 22:58:23 UTC 2018


On Wed, Aug 29, 2018 at 09:14:27AM +1200, Andrew Bartlett wrote:
> G'Day Jeremy,
> 
> Following up from our recent phone call and your gallant offer to
> assist, here are some notify failures I've seen recently that I would
> love to see resolved, as they flap reasonably often:
> 
> [93(538)/94 at 9m51s] samba3.smb2.notify-inotify(fileserver)
> smbtorture 4.10.0pre1-DEVELOPERBUILD
> Using seed 1535488533
> Testing change notify of a rename with inotify
> UNEXPECTED(failure): samba3.smb2.notify-inotify.inotify-
> rename(fileserver)
> REASON: Exception: Exception: ../source4/torture/smb2/notify.c:2441:
> status was NT_STATUS_CANCELLED, expected NT_STATUS_OK: smb2_notify_recv
> failed

OK, here is the first effort. I'm not 100% sure this is
a related fix, but this test was leaving the directory
behind on exit, so this patchset is a needed cleanup
IMHO.

Please review and push if happy. It's in gitlab
test right now.

Cheers,

	Jeremy.
-------------- next part --------------
From 7e1a26b98d0bcf70d04b3dba0557bc50ed38eb1b Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 31 Aug 2018 15:42:26 -0700
Subject: [PATCH 1/3] s4: torture: Ensure all notify tests use separate
 directories.

Makes it much easier to find tests that error out whilst
leaving directories behind.

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source4/torture/smb2/notify.c | 388 ++++++++++++++++++++--------------
 1 file changed, 229 insertions(+), 159 deletions(-)

diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index d13f1c0506c..0e5ba4a7144 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -224,6 +224,9 @@ done:
 /*
    basic testing of change notify on directories
 */
+
+#define BASEDIR_DIR BASEDIR "_DIR"
+
 static bool torture_smb2_notify_dir(struct torture_context *torture,
 			      struct smb2_tree *tree1,
 			      struct smb2_tree *tree2)
@@ -237,13 +240,13 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 	struct smb2_handle h1 = {{0}};
 	struct smb2_handle h2 = {{0}};
 	struct smb2_request *req, *req2;
-	const char *fname = BASEDIR "\\subdir-name";
+	const char *fname = BASEDIR_DIR "\\subdir-name";
 	extern int torture_numops;
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY ON DIRECTORIES\n");
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_DIR);
+	smb2_util_rmdir(tree1, BASEDIR_DIR);
 	/*
 	  get a handle on the directory
 	*/
@@ -259,7 +262,7 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_DIR;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -336,8 +339,9 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 		"Testing buffered notify on create of %d files\n", count);
 	for (i=0;i<count;i++) {
 		struct smb2_handle h12;
-		char *fname2 = talloc_asprintf(torture, BASEDIR "\\test%d.txt",
-					      i);
+		char *fname2 = talloc_asprintf(torture,
+						BASEDIR_DIR "\\test%d.txt",
+						i);
 
 		ZERO_STRUCT(io.smb2);
 		io.generic.level = RAW_OPEN_SMB2;
@@ -376,7 +380,7 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 	notify.smb2.in.file.handle = h1;
 	req = smb2_notify_send(tree1, &(notify.smb2));
 
-	status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
+	status = smb2_util_unlink(tree1, BASEDIR_DIR "\\nonexistent.txt");
 	CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
 
 	/* (1st unlink) as the 2nd notify directly returns,
@@ -384,7 +388,7 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 	   the 3rd notify (later) */
 	torture_comment(torture,
 		"Testing notify on unlink for the first file\n");
-	status = smb2_util_unlink(tree2, BASEDIR "\\test0.txt");
+	status = smb2_util_unlink(tree2, BASEDIR_DIR "\\test0.txt");
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	/* receive the reply from the 2nd notify */
@@ -409,12 +413,12 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 		"(3rd notify) this notify will only see the 1st unlink\n");
 	req = smb2_notify_send(tree1, &(notify.smb2));
 
-	status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
+	status = smb2_util_unlink(tree1, BASEDIR_DIR "\\nonexistent.txt");
 	CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
 
 	for (i=1;i<count;i++) {
 		char *fname2 = talloc_asprintf(torture,
-			      BASEDIR "\\test%d.txt", i);
+			      BASEDIR_DIR "\\test%d.txt", i);
 		status = smb2_util_unlink(tree2, fname2);
 		CHECK_STATUS(status, NT_STATUS_OK);
 		talloc_free(fname2);
@@ -468,7 +472,7 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
 done:
 	smb2_util_close(tree1, h1);
 	smb2_util_close(tree1, h2);
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_DIR);
 	return ret;
 }
 
@@ -496,6 +500,8 @@ done:
    testing of recursive change notify
 */
 
+#define BASEDIR_REC BASEDIR "_REC"
+
 static bool torture_smb2_notify_recursive(struct torture_context *torture,
 				struct smb2_tree *tree1,
 				struct smb2_tree *tree2)
@@ -508,8 +514,8 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	struct smb2_handle h1;
 	struct smb2_request *req1, *req2;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_REC);
+	smb2_util_rmdir(tree1, BASEDIR_REC);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY WITH RECURSION\n");
 
@@ -528,7 +534,7 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_REC;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -571,12 +577,12 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io1.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io1.smb2.in.security_flags = 0;
-	io1.smb2.in.fname = BASEDIR "\\subdir-name";
+	io1.smb2.in.fname = BASEDIR_REC "\\subdir-name";
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree2, io1.smb2.out.file.handle);
 
-	io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname1";
+	io1.smb2.in.fname = BASEDIR_REC "\\subdir-name\\subname1";
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	ZERO_STRUCT(sinfo);
@@ -585,12 +591,12 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	sinfo.rename_information.in.overwrite = 0;
 	sinfo.rename_information.in.root_fid = 0;
 	sinfo.rename_information.in.new_name =
-				BASEDIR "\\subdir-name\\subname1-r";
+				BASEDIR_REC "\\subdir-name\\subname1-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
-	io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
+	io1.smb2.in.fname = BASEDIR_REC "\\subdir-name\\subname2";
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	ZERO_STRUCT(sinfo);
@@ -598,11 +604,11 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
 	sinfo.rename_information.in.overwrite = true;
 	sinfo.rename_information.in.root_fid = 0;
-	sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
+	sinfo.rename_information.in.new_name = BASEDIR_REC "\\subname2-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	io1.smb2.in.fname = BASEDIR "\\subname2-r";
+	io1.smb2.in.fname = BASEDIR_REC "\\subname2-r";
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -611,7 +617,7 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
 	sinfo.rename_information.in.overwrite = true;
 	sinfo.rename_information.in.root_fid = 0;
-	sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
+	sinfo.rename_information.in.new_name = BASEDIR_REC "\\subname3-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -620,11 +626,13 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	smb_msleep(200);
 	req1 = smb2_notify_send(tree1, &(notify.smb2));
 
-	status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
+	status = smb2_util_rmdir(tree2,
+		BASEDIR_REC "\\subdir-name\\subname1-r");
 	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
+	status = smb2_util_rmdir(tree2,
+		BASEDIR_REC "\\subdir-name");
 	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
+	status = smb2_util_unlink(tree2, BASEDIR_REC "\\subname3-r");
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	notify.smb2.in.recursive = false;
@@ -654,7 +662,7 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
 	CHECK_WIRE_STR(notify.smb2.out.changes[8].name, "subname3-r");
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_REC);
 	return ret;
 }
 
@@ -662,6 +670,8 @@ done:
    testing of change notify mask change
 */
 
+#define BASEDIR_MC BASEDIR "_MC"
+
 static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 					    struct smb2_tree *tree1,
 					    struct smb2_tree *tree2)
@@ -674,8 +684,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 	struct smb2_request *req1, *req2;
 	union smb_setfileinfo sinfo;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_MC);
+	smb2_util_rmdir(tree1, BASEDIR_MC);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
 
@@ -694,7 +704,7 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_MC;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -741,14 +751,14 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 	io1.smb2.in.security_flags = 0;
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
-	io1.smb2.in.fname = BASEDIR "\\tname1";
+	io1.smb2.in.fname = BASEDIR_MC "\\tname1";
 
 	smb2_util_close(tree1,
 		custom_smb2_create(tree1, torture, &(io1.smb2)));
-	status = smb2_util_setatr(tree1, BASEDIR "\\tname1",
+	status = smb2_util_setatr(tree1, BASEDIR_MC "\\tname1",
 				FILE_ATTRIBUTE_HIDDEN);
 	CHECK_STATUS(status, NT_STATUS_OK);
-	smb2_util_unlink(tree1, BASEDIR "\\tname1");
+	smb2_util_unlink(tree1, BASEDIR_MC "\\tname1");
 
 	status = smb2_notify_recv(req1, torture, &(notify.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -772,13 +782,13 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
-	io1.smb2.in.fname = BASEDIR "\\subdir-name";
+	io1.smb2.in.fname = BASEDIR_MC "\\subdir-name";
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree2, io1.smb2.out.file.handle);
 
 	ZERO_STRUCT(sinfo);
-	io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname1";
+	io1.smb2.in.fname = BASEDIR_MC "\\subdir-name\\subname1";
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	status = smb2_create(tree2, torture, &(io1.smb2));
@@ -788,36 +798,36 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 	sinfo.rename_information.in.overwrite = true;
 	sinfo.rename_information.in.root_fid = 0;
 	sinfo.rename_information.in.new_name =
-				BASEDIR "\\subdir-name\\subname1-r";
+				BASEDIR_MC "\\subdir-name\\subname1-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
+	io1.smb2.in.fname = BASEDIR_MC "\\subdir-name\\subname2";
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
-	sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
+	sinfo.rename_information.in.new_name = BASEDIR_MC "\\subname2-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree2, io1.smb2.out.file.handle);
 
-	io1.smb2.in.fname = BASEDIR "\\subname2-r";
+	io1.smb2.in.fname = BASEDIR_MC "\\subname2-r";
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
 	status = smb2_create(tree2, torture, &(io1.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
-	sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
+	sinfo.rename_information.in.new_name = BASEDIR_MC "\\subname3-r";
 	status = smb2_setinfo_file(tree2, &sinfo);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree2, io1.smb2.out.file.handle);
 
-	status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
+	status = smb2_util_rmdir(tree2, BASEDIR_MC "\\subdir-name\\subname1-r");
 	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
+	status = smb2_util_rmdir(tree2, BASEDIR_MC "\\subdir-name");
 	CHECK_STATUS(status, NT_STATUS_OK);
-	status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
+	status = smb2_util_unlink(tree2, BASEDIR_MC "\\subname3-r");
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	status = smb2_notify_recv(req1, torture, &(notify.smb2));
@@ -839,7 +849,7 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
 	}
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_MC);
 	return ret;
 }
 
@@ -847,6 +857,8 @@ done:
    testing of mask bits for change notify
 */
 
+#define BASEDIR_MSK BASEDIR "_MSK"
+
 static bool torture_smb2_notify_mask(struct torture_context *torture,
 				     struct smb2_tree *tree1,
 				     struct smb2_tree *tree2)
@@ -861,8 +873,8 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	char c = 1;
 	union smb_setfileinfo sinfo;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_MSK);
+	smb2_util_rmdir(tree1, BASEDIR_MSK);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
 
@@ -884,7 +896,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_MSK;
 
 	ZERO_STRUCT(notify.smb2);
 	notify.smb2.level = RAW_NOTIFY_SMB2;
@@ -960,8 +972,8 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 
 	torture_comment(torture, "Testing mkdir\n");
 	NOTIFY_MASK_TEST("Testing mkdir",;,
-			 smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
-			 smb2_util_rmdir(tree2, BASEDIR "\\tname1");,
+			 smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
+			 smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname1");,
 			 NOTIFY_ACTION_ADDED,
 			 FILE_NOTIFY_CHANGE_DIR_NAME, 1);
 
@@ -977,12 +989,12 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	io1.smb2.in.security_flags = 0;
 	io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
 	io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
-	io1.smb2.in.fname = BASEDIR "\\tname1";
+	io1.smb2.in.fname = BASEDIR_MSK "\\tname1";
 
 	NOTIFY_MASK_TEST("Testing create file",;,
 			 smb2_util_close(tree2, custom_smb2_create(tree2,
 						torture, &(io1.smb2)));,
-			 smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+			 smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
 			 NOTIFY_ACTION_ADDED,
 			 FILE_NOTIFY_CHANGE_FILE_NAME, 1);
 
@@ -990,15 +1002,15 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	NOTIFY_MASK_TEST("Testing unlink",
 			 smb2_util_close(tree2, custom_smb2_create(tree2,
 						torture, &(io1.smb2)));,
-			 smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+			 smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
 			 ;,
 			 NOTIFY_ACTION_REMOVED,
 			 FILE_NOTIFY_CHANGE_FILE_NAME, 1);
 
 	torture_comment(torture, "Testing rmdir\n");
 	NOTIFY_MASK_TEST("Testing rmdir",
-			 smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
-			 smb2_util_rmdir(tree2, BASEDIR "\\tname1");,
+			 smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
+			 smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname1");,
 			 ;,
 			 NOTIFY_ACTION_REMOVED,
 			 FILE_NOTIFY_CHANGE_DIR_NAME, 1);
@@ -1009,12 +1021,12 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	sinfo.rename_information.in.file.handle = h1;
 	sinfo.rename_information.in.overwrite = true;
 	sinfo.rename_information.in.root_fid = 0;
-	sinfo.rename_information.in.new_name = BASEDIR "\\tname2";
+	sinfo.rename_information.in.new_name = BASEDIR_MSK "\\tname2";
 	NOTIFY_MASK_TEST("Testing rename file",
 			 smb2_util_close(tree2, custom_smb2_create(tree2,
 						torture, &(io1.smb2)));,
 			 smb2_setinfo_file(tree2, &sinfo);,
-			 smb2_util_unlink(tree2, BASEDIR "\\tname2");,
+			 smb2_util_unlink(tree2, BASEDIR_MSK "\\tname2");,
 			 NOTIFY_ACTION_OLD_NAME,
 			 FILE_NOTIFY_CHANGE_FILE_NAME, 2);
 
@@ -1024,11 +1036,11 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	sinfo.rename_information.in.file.handle = h1;
 	sinfo.rename_information.in.overwrite = true;
 	sinfo.rename_information.in.root_fid = 0;
-	sinfo.rename_information.in.new_name = BASEDIR "\\tname2";
+	sinfo.rename_information.in.new_name = BASEDIR_MSK "\\tname2";
 	NOTIFY_MASK_TEST("Testing rename dir",
-		smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
+		smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
 		smb2_setinfo_file(tree2, &sinfo);,
-		smb2_util_rmdir(tree2, BASEDIR "\\tname2");,
+		smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname2");,
 		NOTIFY_ACTION_OLD_NAME,
 		FILE_NOTIFY_CHANGE_DIR_NAME, 2);
 
@@ -1036,9 +1048,9 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	NOTIFY_MASK_TEST("Testing set path attribute",
 		smb2_util_close(tree2, custom_smb2_create(tree2,
 				       torture, &(io.smb2)));,
-		smb2_util_setatr(tree2, BASEDIR "\\tname1",
+		smb2_util_setatr(tree2, BASEDIR_MSK "\\tname1",
 				 FILE_ATTRIBUTE_HIDDEN);,
-		smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+		smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
 		NOTIFY_ACTION_MODIFIED,
 		FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
 
@@ -1051,7 +1063,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 		smb2_util_close(tree2, custom_smb2_create(tree2,
 				       torture, &(io1.smb2)));,
 		smb2_setinfo_file(tree2, &sinfo);,
-		smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+		smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
 		NOTIFY_ACTION_MODIFIED,
 		FILE_NOTIFY_CHANGE_LAST_WRITE, 1);
 
@@ -1068,10 +1080,10 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 		torture_comment(torture, "Testing set file create time\n");
 		NOTIFY_MASK_TEST("Testing set file create time",
 			smb2_create_complex_file(torture, tree2,
-			BASEDIR "\\tname1", &h2);,
+			BASEDIR_MSK "\\tname1", &h2);,
 			smb2_setinfo_file(tree2, &sinfo);,
 			(smb2_util_close(tree2, h2),
-			 smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+			 smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
 			NOTIFY_ACTION_MODIFIED,
 			FILE_NOTIFY_CHANGE_CREATION, 1);
 	}
@@ -1082,10 +1094,13 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	sinfo.basic_info.in.access_time = 0;
 	torture_comment(torture, "Testing set file access time\n");
 	NOTIFY_MASK_TEST("Testing set file access time",
-		smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
+		smb2_create_complex_file(torture,
+			tree2,
+			BASEDIR_MSK "\\tname1",
+			&h2);,
 		smb2_setinfo_file(tree2, &sinfo);,
 		(smb2_util_close(tree2, h2),
-		smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+		smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
 		NOTIFY_ACTION_MODIFIED,
 		FILE_NOTIFY_CHANGE_LAST_ACCESS, 1);
 
@@ -1095,28 +1110,35 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 	sinfo.basic_info.in.change_time = 0;
 	torture_comment(torture, "Testing set file change time\n");
 	NOTIFY_MASK_TEST("Testing set file change time",
-		smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
+		smb2_create_complex_file(torture,
+			tree2,
+			BASEDIR_MSK "\\tname1",
+			&h2);,
 		smb2_setinfo_file(tree2, &sinfo);,
 		(smb2_util_close(tree2, h2),
-		smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+		smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
 		NOTIFY_ACTION_MODIFIED,
 		0, 1);
 
 
 	torture_comment(torture, "Testing write\n");
 	NOTIFY_MASK_TEST("Testing write",
-		smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
+		smb2_create_complex_file(torture,
+			tree2,
+			BASEDIR_MSK "\\tname1",
+			&h2);,
 		smb2_util_write(tree2, h2, &c, 10000, 1);,
 		(smb2_util_close(tree2, h2),
-		smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+		smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
 		NOTIFY_ACTION_MODIFIED,
 		0, 1);
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_MSK);
 	return ret;
 }
 
+#define BASEDIR_FL BASEDIR "_FL"
 /*
   basic testing of change notify on files
 */
@@ -1130,13 +1152,13 @@ static bool torture_smb2_notify_file(struct torture_context *torture,
 	union smb_notify notify;
 	struct smb2_request *req;
 	struct smb2_handle h1;
-	const char *fname = BASEDIR "\\file.txt";
+	const char *fname = BASEDIR_FL "\\file.txt";
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_FL);
+	smb2_util_rmdir(tree, BASEDIR_FL);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY ON FILES\n");
-	status = torture_smb2_testdir(tree, BASEDIR, &h1);
+	status = torture_smb2_testdir(tree, BASEDIR_FL, &h1);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	ZERO_STRUCT(io.smb2);
@@ -1182,13 +1204,15 @@ static bool torture_smb2_notify_file(struct torture_context *torture,
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
-	smb2_deltree(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_FL);
 	return ret;
 }
 /*
   basic testing of change notifies followed by a tdis
 */
 
+#define BASEDIR_TD BASEDIR "_TD"
+
 static bool torture_smb2_notify_tree_disconnect(
 		struct torture_context *torture,
 		struct smb2_tree *tree)
@@ -1200,8 +1224,8 @@ static bool torture_smb2_notify_tree_disconnect(
 	struct smb2_handle h1;
 	struct smb2_request *req;
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TD);
+	smb2_util_rmdir(tree, BASEDIR_TD);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY+CANCEL FOLLOWED BY "
 			"TREE-DISCONNECT\n");
@@ -1221,7 +1245,7 @@ static bool torture_smb2_notify_tree_disconnect(
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_TD;
 
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1250,7 +1274,7 @@ static bool torture_smb2_notify_tree_disconnect(
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TD);
 	return ret;
 }
 
@@ -1258,6 +1282,8 @@ done:
   testing of change notifies followed by a tdis - no cancel
 */
 
+#define BASEDIR_NTDIS BASEDIR "_NTDIS"
+
 static bool torture_smb2_notify_tree_disconnect_1(
 		struct torture_context *torture,
 		struct smb2_tree *tree)
@@ -1269,8 +1295,8 @@ static bool torture_smb2_notify_tree_disconnect_1(
 	struct smb2_handle h1;
 	struct smb2_request *req;
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_NTDIS);
+	smb2_util_rmdir(tree, BASEDIR_NTDIS);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY ASYNC FOLLOWED BY "
 			"TREE-DISCONNECT\n");
@@ -1290,7 +1316,7 @@ static bool torture_smb2_notify_tree_disconnect_1(
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_NTDIS;
 
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1316,7 +1342,7 @@ static bool torture_smb2_notify_tree_disconnect_1(
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_NTDIS);
 	return ret;
 }
 
@@ -1324,6 +1350,8 @@ done:
   basic testing of change notifies followed by a close
 */
 
+#define BASEDIR_CNC BASEDIR "_CNC"
+
 static bool torture_smb2_notify_close(struct torture_context *torture,
 				struct smb2_tree *tree1)
 {
@@ -1334,8 +1362,8 @@ static bool torture_smb2_notify_close(struct torture_context *torture,
 	struct smb2_handle h1;
 	struct smb2_request *req;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_CNC);
+	smb2_util_rmdir(tree1, BASEDIR_CNC);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
 
@@ -1354,7 +1382,7 @@ static bool torture_smb2_notify_close(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_CNC;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1385,7 +1413,7 @@ static bool torture_smb2_notify_close(struct torture_context *torture,
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_CNC);
 	return ret;
 }
 
@@ -1393,6 +1421,7 @@ done:
   basic testing of change notifies followed by a ulogoff
 */
 
+#define BASEDIR_NUL BASEDIR "_NUL"
 static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
 				struct smb2_tree *tree1)
 {
@@ -1403,8 +1432,8 @@ static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
 	struct smb2_handle h1;
 	struct smb2_request *req;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NUL);
+	smb2_util_rmdir(tree1, BASEDIR_NUL);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
 
@@ -1423,7 +1452,7 @@ static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_NUL;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1454,7 +1483,7 @@ static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NUL);
 	return ret;
 }
 
@@ -1462,6 +1491,8 @@ done:
   basic testing of change notifies followed by a session reconnect
 */
 
+#define BASEDIR_NSR BASEDIR "_NSR"
+
 static bool torture_smb2_notify_session_reconnect(struct torture_context *torture,
 				struct smb2_tree *tree1)
 {
@@ -1474,8 +1505,8 @@ static bool torture_smb2_notify_session_reconnect(struct torture_context *tortur
 	uint64_t previous_session_id = 0;
 	struct smb2_session *session2 = NULL;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NSR);
+	smb2_util_rmdir(tree1, BASEDIR_NSR);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY SESSION RECONNECT\n");
 
@@ -1494,7 +1525,7 @@ static bool torture_smb2_notify_session_reconnect(struct torture_context *tortur
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_NSR;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1534,7 +1565,7 @@ static bool torture_smb2_notify_session_reconnect(struct torture_context *tortur
 	status = smb2_logoff(session2);
 	CHECK_STATUS(status, NT_STATUS_OK);
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NSR);
 	return ret;
 }
 
@@ -1542,6 +1573,8 @@ done:
   basic testing of change notifies followed by an invalid reauth
 */
 
+#define BASEDIR_IR BASEDIR "_IR"
+
 static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
 					       struct smb2_tree *tree1,
 					       struct smb2_tree *tree2)
@@ -1554,8 +1587,8 @@ static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
 	struct smb2_request *req;
 	struct cli_credentials *invalid_creds;
 
-	smb2_deltree(tree2, BASEDIR);
-	smb2_util_rmdir(tree2, BASEDIR);
+	smb2_deltree(tree2, BASEDIR_IR);
+	smb2_util_rmdir(tree2, BASEDIR_IR);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY invalid REAUTH\n");
 
@@ -1574,7 +1607,7 @@ static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_IR;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1615,7 +1648,7 @@ static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree2, BASEDIR);
+	smb2_deltree(tree2, BASEDIR_IR);
 	return ret;
 }
 
@@ -1632,6 +1665,8 @@ static void tcp_dis_handler(struct smb2_transport *t, void *p)
   basic testing of change notifies followed by tcp disconnect
 */
 
+#define BASEDIR_NTCPD BASEDIR "_NTCPD"
+
 static bool torture_smb2_notify_tcp_disconnect(
 		struct torture_context *torture,
 		struct smb2_tree *tree)
@@ -1643,8 +1678,8 @@ static bool torture_smb2_notify_tcp_disconnect(
 	struct smb2_handle h1;
 	struct smb2_request *req;
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_NTCPD);
+	smb2_util_rmdir(tree, BASEDIR_NTCPD);
 
 	torture_comment(torture,
 		"TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n");
@@ -1664,7 +1699,7 @@ static bool torture_smb2_notify_tcp_disconnect(
 	io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_NTCPD;
 
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1700,6 +1735,8 @@ done:
    test setting up two change notify requests on one handle
 */
 
+#define BASEDIR_NDOH BASEDIR "_NDOH"
+
 static bool torture_smb2_notify_double(struct torture_context *torture,
 			struct smb2_tree *tree1,
 			struct smb2_tree *tree2)
@@ -1711,8 +1748,8 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
 	struct smb2_handle h1;
 	struct smb2_request *req1, *req2;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NDOH);
+	smb2_util_rmdir(tree1, BASEDIR_NDOH);
 
 	torture_comment(torture,
 		"TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
@@ -1734,7 +1771,7 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_NDOH;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1759,7 +1796,7 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
 	status = smb2_notify_recv(req2, torture, &(notify.smb2));
 	CHECK_STATUS(status, NT_STATUS_CANCELLED);
 
-	smb2_util_mkdir(tree2, BASEDIR "\\subdir-name");
+	smb2_util_mkdir(tree2, BASEDIR_NDOH "\\subdir-name");
 	req1 = smb2_notify_send(tree1, &(notify.smb2));
 	req2 = smb2_notify_send(tree1, &(notify.smb2));
 
@@ -1768,7 +1805,7 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
 	CHECK_VAL(notify.smb2.out.num_changes, 1);
 	CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
 
-	smb2_util_mkdir(tree2, BASEDIR "\\subdir-name2");
+	smb2_util_mkdir(tree2, BASEDIR_NDOH "\\subdir-name2");
 
 	status = smb2_notify_recv(req2, torture, &(notify.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1776,7 +1813,7 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
 	CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name2");
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_NDOH);
 	return ret;
 }
 
@@ -1785,6 +1822,8 @@ done:
    test multiple change notifies at different depths and with/without recursion
 */
 
+#define BASEDIR_TREE BASEDIR "_TREE"
+
 static bool torture_smb2_notify_tree(struct torture_context *torture,
 			     struct smb2_tree *tree)
 {
@@ -1801,33 +1840,53 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
 		struct smb2_handle h1;
 		int counted;
 	} dirs[] = {
-		{BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 30 },
-		{BASEDIR "\\zqy",               true, FILE_NOTIFY_CHANGE_NAME, 8 },
-		{BASEDIR "\\atsy",              true, FILE_NOTIFY_CHANGE_NAME, 4 },
-		{BASEDIR "\\abc\\foo",          true,  FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\abc\\blah",         true,  FILE_NOTIFY_CHANGE_NAME, 13 },
-		{BASEDIR "\\abc\\blah",         false, FILE_NOTIFY_CHANGE_NAME, 7 },
-		{BASEDIR "\\abc\\blah\\a",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\abc\\blah\\b",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\abc\\blah\\c",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\abc\\fooblah",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\zqy\\xx",           true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\zqy\\yyy",          true, FILE_NOTIFY_CHANGE_NAME, 2 },
-		{BASEDIR "\\zqy\\..",           true, FILE_NOTIFY_CHANGE_NAME, 40 },
-		{BASEDIR,                       true, FILE_NOTIFY_CHANGE_NAME, 40 },
-		{BASEDIR,                       false,FILE_NOTIFY_CHANGE_NAME, 6 },
-		{BASEDIR "\\atsy",              false,FILE_NOTIFY_CHANGE_NAME, 4 },
-		{BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 24 },
-		{BASEDIR "\\abc",               false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
-		{BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
-		{BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 24 },
+		{BASEDIR_TREE "\\abc",
+			true, FILE_NOTIFY_CHANGE_NAME, 30 },
+		{BASEDIR_TREE "\\zqy",
+			true, FILE_NOTIFY_CHANGE_NAME, 8 },
+		{BASEDIR_TREE "\\atsy",
+			true, FILE_NOTIFY_CHANGE_NAME, 4 },
+		{BASEDIR_TREE "\\abc\\foo",
+			true,  FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\abc\\blah",
+			true,  FILE_NOTIFY_CHANGE_NAME, 13 },
+		{BASEDIR_TREE "\\abc\\blah",
+			false, FILE_NOTIFY_CHANGE_NAME, 7 },
+		{BASEDIR_TREE "\\abc\\blah\\a",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\abc\\blah\\b",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\abc\\blah\\c",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\abc\\fooblah",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\zqy\\xx",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\zqy\\yyy",
+			true, FILE_NOTIFY_CHANGE_NAME, 2 },
+		{BASEDIR_TREE "\\zqy\\..",
+			true, FILE_NOTIFY_CHANGE_NAME, 40 },
+		{BASEDIR_TREE,
+			true, FILE_NOTIFY_CHANGE_NAME, 40 },
+		{BASEDIR_TREE,
+			false,FILE_NOTIFY_CHANGE_NAME, 6 },
+		{BASEDIR_TREE "\\atsy",
+			false,FILE_NOTIFY_CHANGE_NAME, 4 },
+		{BASEDIR_TREE "\\abc",
+			true, FILE_NOTIFY_CHANGE_NAME, 24 },
+		{BASEDIR_TREE "\\abc",
+			false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
+		{BASEDIR_TREE "\\abc",
+			true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
+		{BASEDIR_TREE "\\abc",
+			true, FILE_NOTIFY_CHANGE_NAME, 24 },
 	};
 	int i;
 	NTSTATUS status;
 	bool all_done = false;
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TREE);
+	smb2_util_rmdir(tree, BASEDIR_TREE);
 
 	torture_comment(torture, "TESTING NOTIFY FOR DIFFERENT DEPTHS\n");
 
@@ -1843,7 +1902,7 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_TREE;
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 
@@ -1926,8 +1985,8 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
 	}
 
 done:
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TREE);
+	smb2_util_rmdir(tree, BASEDIR_TREE);
 	return ret;
 }
 
@@ -1936,6 +1995,8 @@ done:
    packet size.
 */
 
+#define BASEDIR_OVF BASEDIR "_OVF"
+
 static bool torture_smb2_notify_overflow(struct torture_context *torture,
 				struct smb2_tree *tree)
 {
@@ -1948,8 +2009,8 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
 	struct smb2_request *req1;
 	int i;
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_OVF);
+	smb2_util_rmdir(tree, BASEDIR_OVF);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY EVENT OVERFLOW\n");
 
@@ -1966,7 +2027,7 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_OVF;
 
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -1994,7 +2055,7 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
 
 	for (i=0;i<count;i++) {
 		char *fname = talloc_asprintf(torture,
-			      BASEDIR "\\test%d.txt", i);
+			      BASEDIR_OVF "\\test%d.txt", i);
 		union smb_open io1;
 		ZERO_STRUCT(io1.smb2);
 	        io1.generic.level = RAW_OPEN_SMB2;
@@ -2021,7 +2082,7 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
 	CHECK_VAL(notify.smb2.out.num_changes, 0);
 
 done:
-	smb2_deltree(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_OVF);
 	return ret;
 }
 
@@ -2030,6 +2091,8 @@ done:
    They shouldn't be.
 */
 
+#define BASEDIR_BAS BASEDIR "_BAS"
+
 static bool torture_smb2_notify_basedir(struct torture_context *torture,
 				struct smb2_tree *tree1,
 				struct smb2_tree *tree2)
@@ -2041,8 +2104,8 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
 	struct smb2_handle h1;
 	struct smb2_request *req1;
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_BAS);
+	smb2_util_rmdir(tree1, BASEDIR_BAS);
 
 	torture_comment(torture, "TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
 
@@ -2059,14 +2122,14 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io.smb2.in.impersonation_level = NTCREATEX_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_BAS;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
 	h1 = io.smb2.out.file.handle;
 
 	/* create a test file that will also be modified */
-	io.smb2.in.fname = BASEDIR "\\tname1";
+	io.smb2.in.fname = BASEDIR_BAS "\\tname1";
 	io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
 	status =  smb2_create(tree2, torture, &(io.smb2));
 	CHECK_STATUS(status,NT_STATUS_OK);
@@ -2083,10 +2146,10 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
 	req1 = smb2_notify_send(tree1, &(notify.smb2));
 
 	/* set attribute on the base dir */
-	smb2_util_setatr(tree2, BASEDIR, FILE_ATTRIBUTE_HIDDEN);
+	smb2_util_setatr(tree2, BASEDIR_BAS, FILE_ATTRIBUTE_HIDDEN);
 
 	/* set attribute on a file to assure we receive a notification */
-	smb2_util_setatr(tree2, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN);
+	smb2_util_setatr(tree2, BASEDIR_BAS "\\tname1", FILE_ATTRIBUTE_HIDDEN);
 	smb_msleep(200);
 
 	/* check how many responses were given, expect only 1 for the file */
@@ -2097,13 +2160,16 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
 	CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "tname1");
 
 done:
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_BAS);
 	return ret;
 }
 
 /*
    very simple change notify test
 */
+
+#define BASEDIR_TCON BASEDIR "_TCON"
+
 static bool torture_smb2_notify_tcon(struct torture_context *torture,
 				  struct smb2_tree *tree)
 {
@@ -2114,10 +2180,10 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
 	struct smb2_handle h1 = {{0}};
 	struct smb2_request *req = NULL;
 	struct smb2_tree *tree1 = NULL;
-	const char *fname = BASEDIR "\\subdir-name";
+	const char *fname = BASEDIR_TCON "\\subdir-name";
 
-	smb2_deltree(tree, BASEDIR);
-	smb2_util_rmdir(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TCON);
+	smb2_util_rmdir(tree, BASEDIR_TCON);
 
 	torture_comment(torture, "TESTING SIMPLE CHANGE NOTIFY\n");
 
@@ -2138,7 +2204,7 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_TCON;
 
 	status = smb2_create(tree, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -2247,11 +2313,13 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
 	torture_comment(torture, "CHANGE NOTIFY WITH TDIS OK\n");
 done:
 	smb2_util_close(tree, h1);
-	smb2_deltree(tree, BASEDIR);
+	smb2_deltree(tree, BASEDIR_TCON);
 
 	return ret;
 }
 
+#define BASEDIR_RMD BASEDIR "_RMD"
+
 static bool torture_smb2_notify_rmdir(struct torture_context *torture,
 				      struct smb2_tree *tree1,
 				      struct smb2_tree *tree2,
@@ -2267,8 +2335,8 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
 
 	torture_comment(torture, "TESTING NOTIFY CANCEL FOR DELETED DIR\n");
 
-	smb2_deltree(tree1, BASEDIR);
-	smb2_util_rmdir(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_RMD);
+	smb2_util_rmdir(tree1, BASEDIR_RMD);
 
 	ZERO_STRUCT(io.smb2);
 	io.generic.level = RAW_OPEN_SMB2;
@@ -2284,7 +2352,7 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
 	io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
 	io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
 	io.smb2.in.security_flags = 0;
-	io.smb2.in.fname = BASEDIR;
+	io.smb2.in.fname = BASEDIR_RMD;
 
 	status = smb2_create(tree1, torture, &(io.smb2));
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -2302,7 +2370,7 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
 	req = smb2_notify_send(tree1, &(notify.smb2));
 
 	if (initial_delete_on_close) {
-		status = smb2_util_rmdir(tree2, BASEDIR);
+		status = smb2_util_rmdir(tree2, BASEDIR_RMD);
 		CHECK_STATUS(status, NT_STATUS_OK);
 	} else {
 		status = smb2_create(tree2, torture, &(io.smb2));
@@ -2323,7 +2391,7 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
 done:
 
 	smb2_util_close(tree1, h);
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_RMD);
 
 	return ret;
 }
@@ -2365,6 +2433,8 @@ static void notify_timeout(struct tevent_context *ev,
 	smb2_cancel(req);
 }
 
+#define BASEDIR_INR BASEDIR "_INR"
+
 static bool torture_smb2_inotify_rename(struct torture_context *torture,
 					struct smb2_tree *tree1,
 					struct smb2_tree *tree2)
@@ -2381,11 +2451,11 @@ static bool torture_smb2_inotify_rename(struct torture_context *torture,
 	struct tevent_timer *te = NULL;
 	bool ok = false;
 
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_INR);
 
 	torture_comment(torture, "Testing change notify of a rename with inotify\n");
 
-	status = torture_smb2_testdir(tree1, BASEDIR, &h1);
+	status = torture_smb2_testdir(tree1, BASEDIR_INR, &h1);
 	torture_assert_ntstatus_ok_goto(torture, status, ok, done, "torture_smb2_testdir failed");
 
 	ZERO_STRUCT(create);
@@ -2399,7 +2469,7 @@ static bool torture_smb2_inotify_rename(struct torture_context *torture,
 		NTCREATEX_SHARE_ACCESS_DELETE;
 	create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
 	create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
-	create.in.fname = BASEDIR "\\subdir-name";
+	create.in.fname = BASEDIR_INR "\\subdir-name";
 
 	status = smb2_create(tree2, torture, &create);
 	torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_create failed\n");
@@ -2423,7 +2493,7 @@ static bool torture_smb2_inotify_rename(struct torture_context *torture,
 	ZERO_STRUCT(sinfo);
 	sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
 	sinfo.rename_information.in.file.handle = h2;
-	sinfo.rename_information.in.new_name = BASEDIR "\\subdir-name-r";
+	sinfo.rename_information.in.new_name = BASEDIR_INR "\\subdir-name-r";
 
 	status = smb2_setinfo_file(tree2, &sinfo);
 	torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_setinfo_file failed\n");
@@ -2495,7 +2565,7 @@ done:
 		smb2_util_close(tree2, h2);
 	}
 
-	smb2_deltree(tree1, BASEDIR);
+	smb2_deltree(tree1, BASEDIR_INR);
 	return ok;
 }
 
-- 
2.19.0.rc1.350.ge57e33dbd1-goog


From e3106e974464d65a730680b3c7f5c5dd84c3f030 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 31 Aug 2018 15:43:41 -0700
Subject: [PATCH 2/3] s4: torture: Ensure we can't exit without deleting our
 directory.

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source4/torture/smb2/notify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 0e5ba4a7144..02a76c626e3 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -2486,7 +2486,7 @@ static bool torture_smb2_inotify_rename(struct torture_context *torture,
 
 	while (!NT_STATUS_EQUAL(req->status, STATUS_PENDING)) {
 		if (tevent_loop_once(torture->ev) != 0) {
-			return false;
+			goto done;
 		}
 	}
 
-- 
2.19.0.rc1.350.ge57e33dbd1-goog


From b10be4df5d39fa7c61e9053be976c8b6591d676e Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 31 Aug 2018 15:44:16 -0700
Subject: [PATCH 3/3] s4: torture: Ensure we close the handle on the correct
 tree-id.

Otherwise we leave a directory behind on exit.

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source4/torture/smb2/notify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 02a76c626e3..ebb4f8a4f8e 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -2559,7 +2559,7 @@ static bool torture_smb2_inotify_rename(struct torture_context *torture,
 	ok = true;
 done:
 	if (!smb2_util_handle_empty(h1)) {
-		smb2_util_close(tree2, h1);
+		smb2_util_close(tree1, h1);
 	}
 	if (!smb2_util_handle_empty(h2)) {
 		smb2_util_close(tree2, h2);
-- 
2.19.0.rc1.350.ge57e33dbd1-goog



More information about the samba-technical mailing list