revert source4/torture/smb2/durable_v2_open.c
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Aug 2018 19:51:08 +0000 (21:51 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 14 Aug 2018 19:51:08 +0000 (21:51 +0200)
source4/torture/smb2/durable_v2_open.c

index df755bbe286be30d910a78f906950870cc9da4b7..0a928ec8c2651321ebbd14b34c02de5fbd8a88e2 100644 (file)
@@ -2011,674 +2011,6 @@ bool test_persistent_open_lease(struct torture_context *tctx,
        return ret;
 }
 
-#define COMPARE_WRITE_TIME_CMP(given, correct, cmp) do { \
-       uint64_t r = 10*1000*1000; \
-       NTTIME g = (given).basic_info.out.write_time; \
-       NTTIME gr = (g / r) * r; \
-       NTTIME _c = (correct).basic_info.out.write_time; \
-       NTTIME cr = (_c / r) * r; \
-       bool strict = torture_setting_bool(tctx, "strict mode", false); \
-       bool err = false; \
-       if (strict && (g cmp _c)) { \
-               err = true; \
-       } else if ((g cmp _c) && (gr cmp cr)) { \
-               /* handle filesystem without high resolution timestamps */ \
-               err = true; \
-       } \
-       if (err) { \
-               torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s(%llu) %s (%s)%s(%llu)", \
-                               #given, nt_time_string(tctx, g), (unsigned long long)g, \
-                               #cmp, #correct, nt_time_string(tctx, _c), (unsigned long long)_c); \
-               ret = false; \
-               goto done; \
-       } \
-} while (0)
-#define COMPARE_WRITE_TIME_EQUAL(given,correct) \
-       COMPARE_WRITE_TIME_CMP(given,correct,!=)
-#define COMPARE_WRITE_TIME_GREATER(given,correct) \
-       COMPARE_WRITE_TIME_CMP(given,correct,<=)
-#define COMPARE_WRITE_TIME_LESS(given,correct) \
-       COMPARE_WRITE_TIME_CMP(given,correct,>=)
-
-#define COMPARE_ACCESS_TIME_CMP(given, correct, cmp) do { \
-       NTTIME g = (given).basic_info.out.access_time; \
-       NTTIME c = (correct).basic_info.out.access_time; \
-       if (g cmp c) { \
-               torture_result(tctx, TORTURE_FAIL, __location__": wrong access_time (%s)%s %s (%s)%s", \
-                               #given, nt_time_string(tctx, g), \
-                               #cmp, #correct, nt_time_string(tctx, c)); \
-               ret = false; \
-               goto done; \
-       } \
-} while (0)
-#define COMPARE_ACCESS_TIME_EQUAL(given,correct) \
-       COMPARE_ACCESS_TIME_CMP(given,correct,!=)
-
-#define COMPARE_BOTH_TIMES_EQUAL(given,correct) do { \
-       COMPARE_ACCESS_TIME_EQUAL(given,correct); \
-       COMPARE_WRITE_TIME_EQUAL(given,correct); \
-} while (0)
-
-#define GET_INFO_FILE(finfo) do { \
-       NTSTATUS _status; \
-       _status = smb2_getinfo_file(tree, tctx, &finfo); \
-       if (!NT_STATUS_IS_OK(_status)) { \
-               ret = false; \
-               torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", \
-                              nt_errstr(_status)); \
-               goto done; \
-       } \
-       torture_comment(tctx, "fileinfo: Access(%s) Write(%s)\n", \
-                       nt_time_string(tctx, finfo.basic_info.out.access_time), \
-                       nt_time_string(tctx, finfo.basic_info.out.write_time)); \
-} while (0)
-
-#define SET_INFO_FILE_EX(finfo, wrtime, tree, tfnum) do { \
-       NTSTATUS _status; \
-       union smb_setfileinfo sfinfo; \
-       sfinfo.basic_info.level = RAW_SFILEINFO_BASIC_INFO; \
-       sfinfo.basic_info.in.file.fnum = tfnum; \
-       sfinfo.basic_info.in.create_time = 0; \
-       sfinfo.basic_info.in.access_time = 0; \
-       unix_to_nt_time(&sfinfo.basic_info.in.write_time, (wrtime)); \
-       sfinfo.basic_info.in.change_time = 0; \
-       sfinfo.basic_info.in.attrib = finfo1.basic_info.out.attrib; \
-       _status = smb_raw_setfileinfo(tree, &sfinfo); \
-       if (!NT_STATUS_IS_OK(_status)) { \
-               torture_result(tctx, TORTURE_FAIL, __location__": setfileinfo failed: %s", \
-                              nt_errstr(_status)); \
-               ret = false; \
-               goto done; \
-       } \
-} while (0)
-#define SET_INFO_FILE(finfo, wrtime) \
-       SET_INFO_FILE_EX(finfo, wrtime, cli->tree, fnum1)
-
-#define SET_INFO_FILE_NS(finfo, wrtime, ns, tree, tfnum) do { \
-       NTSTATUS _status; \
-       union smb_setfileinfo sfinfo; \
-       sfinfo.basic_info.level = RAW_SFILEINFO_BASIC_INFO; \
-       sfinfo.basic_info.in.file.fnum = tfnum; \
-       sfinfo.basic_info.in.create_time = 0; \
-       sfinfo.basic_info.in.access_time = 0; \
-       unix_to_nt_time(&sfinfo.basic_info.in.write_time, (wrtime)); \
-       sfinfo.basic_info.in.write_time += (ns); \
-       sfinfo.basic_info.in.change_time = 0; \
-       sfinfo.basic_info.in.attrib = finfo1.basic_info.out.attrib; \
-       _status = smb_raw_setfileinfo(tree, &sfinfo); \
-       if (!NT_STATUS_IS_OK(_status)) { \
-               torture_result(tctx, TORTURE_FAIL, __location__": setfileinfo failed: %s", \
-                              nt_errstr(_status)); \
-               ret = false; \
-               goto done; \
-       } \
-} while (0)
-
-#if 0
-static bool test_delayed_write_update3(struct torture_context *tctx,
-                                      struct smbcli_state *cli,
-                                      struct smbcli_state *cli2)
-{
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
-       const char *fname = BASEDIR "\\torture_file3.txt";
-       int fnum1 = -1;
-       bool ret = true;
-       ssize_t written;
-       struct timeval start;
-       struct timeval end;
-       double used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
-       int normal_delay = 2000000;
-       double sec = ((double)used_delay) / ((double)normal_delay);
-       int msec = 1000 * sec;
-
-       torture_comment(tctx, "\nRunning test_delayed_write_update3\n");
-
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
-
-       torture_comment(tctx, "Open the file handle\n");
-       fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-       if (fnum1 == -1) {
-               ret = false;
-               torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname);
-               goto done;
-       }
-
-       finfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
-       finfo0.basic_info.in.file.fnum = fnum1;
-       finfo1 = finfo0;
-       finfo2 = finfo0;
-       finfo3 = finfo0;
-       pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
-       pinfo0.basic_info.in.file.path = fname;
-       pinfo1 = pinfo0;
-       pinfo2 = pinfo0;
-       pinfo3 = pinfo0;
-       pinfo4 = pinfo0;
-
-       /* get the initial times */
-       GET_INFO_BOTH(finfo0,pinfo0);
-
-       /*
-        * make sure the write time is updated 2 seconds later
-        * calcuated from the first write
-        * (but expect upto 5 seconds extra time for a busy server)
-        */
-       start = timeval_current();
-       end = timeval_add(&start, 7 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_FILE(finfo1);
-
-               if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       if (diff < (used_delay / (double)1000000)) {
-                               torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                               "(write time update delay == %.2f) (wrong!)\n",
-                                               diff, used_delay / (double)1000000);
-                               ret = false;
-                               break;
-                       }
-
-                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
-                                       "(correct)\n",
-                                       diff);
-                       break;
-               }
-               smb_msleep(0.5 * msec);
-       }
-
-       GET_INFO_BOTH(finfo1,pinfo1);
-       COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0);
-
-       /* sure any further write doesn't update the write time */
-       start = timeval_current();
-       end = timeval_add(&start, 15 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_BOTH(finfo2,pinfo2);
-
-               if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                       "(wrong!)\n",
-                                       diff);
-                       ret = false;
-                       break;
-               }
-               smb_msleep(1 * msec);
-       }
-
-       GET_INFO_BOTH(finfo2,pinfo2);
-       COMPARE_WRITE_TIME_EQUAL(finfo2, finfo1);
-       if (finfo2.basic_info.out.write_time == finfo1.basic_info.out.write_time) {
-               torture_comment(tctx, "Server did not update write_time (correct)\n");
-       }
-
-       /* sleep */
-       smb_msleep(5 * msec);
-
-       GET_INFO_BOTH(finfo3,pinfo3);
-       COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
-
-       /*
-        * the close updates the write time to the time of the close
-        * and not to the time of the last write!
-        */
-       torture_comment(tctx, "Close the file handle\n");
-       smbcli_close(cli->tree, fnum1);
-       fnum1 = -1;
-
-       GET_INFO_PATH(pinfo4);
-       COMPARE_WRITE_TIME_GREATER(pinfo4, pinfo3);
-
-       if (pinfo4.basic_info.out.write_time > pinfo3.basic_info.out.write_time) {
-               torture_comment(tctx, "Server updated the write_time on close (correct)\n");
-       }
-
- done:
-       if (fnum1 != -1)
-               smbcli_close(cli->tree, fnum1);
-       smbcli_unlink(cli->tree, fname);
-       smbcli_deltree(cli->tree, BASEDIR);
-
-       return ret;
-}
-
-/*
- * Show that a truncate write always updates the write time even
- * if an initial write has already updated the write time.
- */
-
-static bool test_delayed_write_update3a(struct torture_context *tctx,
-                                       struct smbcli_state *cli,
-                                       struct smbcli_state *cli2)
-{
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
-       const char *fname = BASEDIR "\\torture_file3a.txt";
-       int fnum1 = -1;
-       bool ret = true;
-       ssize_t written;
-       int i;
-       struct timeval start;
-       struct timeval end;
-       double used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
-       int normal_delay = 2000000;
-       double sec = ((double)used_delay) / ((double)normal_delay);
-       int msec = 1000 * sec;
-
-       torture_comment(tctx, "\nRunning test_delayed_write_update3a\n");
-
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
-
-       torture_comment(tctx, "Open the file handle\n");
-       fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-       if (fnum1 == -1) {
-               ret = false;
-               torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname);
-               goto done;
-       }
-
-       finfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
-       finfo0.basic_info.in.file.fnum = fnum1;
-       finfo1 = finfo0;
-       finfo2 = finfo0;
-       finfo3 = finfo0;
-       pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
-       pinfo0.basic_info.in.file.path = fname;
-       pinfo1 = pinfo0;
-       pinfo2 = pinfo0;
-       pinfo3 = pinfo0;
-       pinfo4 = pinfo0;
-
-       /* get the initial times */
-       GET_INFO_BOTH(finfo0,pinfo0);
-
-       /*
-        * sleep some time, to demonstrate the handling of write times
-        * doesn't depend on the time since the open
-        */
-       smb_msleep(5 * msec);
-
-       /* get the initial times */
-       GET_INFO_BOTH(finfo1,pinfo1);
-       COMPARE_WRITE_TIME_EQUAL(finfo1, finfo0);
-
-       /*
-        * make sure the write time is updated 2 seconds later
-        * calcuated from the first write
-        * (but expect upto 5 seconds extra time for a busy server)
-        */
-       start = timeval_current();
-       end = timeval_add(&start, 7 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_FILE(finfo1);
-
-               if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       if (diff < (used_delay / (double)1000000)) {
-                               torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                               "(1sec == %.2f) (wrong!)\n",
-                                               diff, sec);
-                               ret = false;
-                               break;
-                       }
-
-                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
-                                       "(correct)\n",
-                                       diff);
-                       break;
-               }
-               smb_msleep(0.5 * msec);
-       }
-
-       GET_INFO_BOTH(finfo1,pinfo1);
-       COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0);
-
-       smb_msleep(3 * msec);
-
-       /*
-        * demonstrate that a truncate write always
-        * updates the write time immediately
-        */
-       for (i=0; i < 3; i++) {
-               smb_msleep(2 * msec);
-               /* do a write */
-               torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
-               written = smbcli_smbwrite(cli->tree, fnum1, "x", 10240, 0);
-               if (written != 0) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 0", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_BOTH(finfo2,pinfo2);
-               COMPARE_WRITE_TIME_GREATER(finfo2, finfo1);
-               finfo1 = finfo2;
-       }
-
-       smb_msleep(3 * msec);
-
-       /* sure any further write doesn't update the write time */
-       start = timeval_current();
-       end = timeval_add(&start, 15 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_BOTH(finfo2,pinfo2);
-
-               if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                       "(wrong!)\n",
-                                       diff);
-                       ret = false;
-                       break;
-               }
-               smb_msleep(1 * msec);
-       }
-
-       GET_INFO_BOTH(finfo2,pinfo2);
-       COMPARE_WRITE_TIME_EQUAL(finfo2, finfo1);
-       if (finfo2.basic_info.out.write_time == finfo1.basic_info.out.write_time) {
-               torture_comment(tctx, "Server did not update write_time (correct)\n");
-       }
-
-       /* sleep */
-       smb_msleep(3 * msec);
-
-       /* get the initial times */
-       GET_INFO_BOTH(finfo1,pinfo1);
-       COMPARE_WRITE_TIME_EQUAL(finfo1, finfo2);
-
-       /*
-        * demonstrate that a truncate write always
-        * updates the write time immediately
-        */
-       for (i=0; i < 3; i++) {
-               smb_msleep(2 * msec);
-               /* do a write */
-               torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
-               written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0);
-               if (written != 0) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 0", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_BOTH(finfo2,pinfo2);
-               COMPARE_WRITE_TIME_GREATER(finfo2, finfo1);
-               finfo1 = finfo2;
-       }
-
-       /* sleep */
-       smb_msleep(3 * msec);
-
-       GET_INFO_BOTH(finfo3,pinfo3);
-       COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
-
-       /*
-        * the close doesn't update the write time
-        */
-       torture_comment(tctx, "Close the file handle\n");
-       smbcli_close(cli->tree, fnum1);
-       fnum1 = -1;
-
-       GET_INFO_PATH(pinfo4);
-       COMPARE_WRITE_TIME_EQUAL(pinfo4, pinfo3);
-
-       if (pinfo4.basic_info.out.write_time == pinfo3.basic_info.out.write_time) {
-               torture_comment(tctx, "Server did not update the write_time on close (correct)\n");
-       }
-
- done:
-       if (fnum1 != -1)
-               smbcli_close(cli->tree, fnum1);
-       smbcli_unlink(cli->tree, fname);
-       smbcli_deltree(cli->tree, BASEDIR);
-
-       return ret;
-}
-#endif
-
-
-static bool test_durable_v2_delaywrite1(struct torture_context *tctx,
-                                       struct smb2_tree *tree)
-{
-       NTSTATUS status;
-       TALLOC_CTX *mem_ctx = talloc_new(tctx);
-       char fname[256];
-       struct smb2_handle _h;
-       struct smb2_handle *h = NULL;
-       struct smb2_create io;
-       struct GUID create_guid = GUID_random();
-       union smb_fileinfo finfo0;
-       union smb_fileinfo finfo1;
-       union smb_fileinfo finfo2;
-       union smb_fileinfo finfo3;
-       struct smb2_close cl;
-       struct smb2_write wr;
-       ssize_t written;
-       struct timeval start;
-       struct timeval end;
-       //double used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
-       double used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 1000000);
-       int normal_delay = 1000000;
-       //int normal_delay = 2000000;
-       double sec = ((double)used_delay) / ((double)normal_delay);
-       int msec = 1000 * sec;
-       bool ret = true;
-
-       /* Choose a random name in case the state is left a little funky. */
-       snprintf(fname, 256, "durable_v2_delaywrite1_%s.dat",
-                generate_random_str(tctx, 8));
-
-       smb2_util_unlink(tree, fname);
-
-       smb2_oplock_create_share(&io, fname,
-                                smb2_util_share_access(""),
-                                smb2_util_oplock_level("b"));
-       io.in.durable_open = false;
-       io.in.durable_open_v2 = true;
-       io.in.persistent_open = false;
-       io.in.create_guid = create_guid;
-       io.in.timeout = UINT32_MAX;
-
-       status = smb2_create(tree, mem_ctx, &io);
-       CHECK_STATUS(status, NT_STATUS_OK);
-       _h = io.out.file.handle;
-       h = &_h;
-       CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
-       CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
-       CHECK_VAL(io.out.durable_open, false);
-       CHECK_VAL(io.out.durable_open_v2, true);
-       CHECK_VAL(io.out.persistent_open, false);
-       //CHECK_VAL(io.out.timeout, io.in.timeout);
-
-       ZERO_STRUCT(finfo0);
-       finfo0.basic_info.level = RAW_FILEINFO_BASIC_INFORMATION;
-       finfo0.basic_info.in.file.handle = *h;
-       finfo1 = finfo0;
-       finfo2 = finfo0;
-       finfo3 = finfo0;
-
-       /* get the initial times */
-       GET_INFO_FILE(finfo0);
-
-       /*
-        * make sure the write time is updated 2 seconds later
-        * calcuated from the first write
-        * (but expect upto 5 seconds extra time for a busy server)
-        */
-       start = timeval_current();
-       end = timeval_add(&start, 7 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               ZERO_STRUCT(wr);
-               wr.in.file.handle = *h;
-               wr.in.offset      = 0;
-               wr.in.data        = data_blob_const("x", 1);
-               status = smb2_write(tree, &wr);
-               CHECK_STATUS(status, NT_STATUS_OK);
-               written = wr.out.nwritten;
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_FILE(finfo1);
-
-               if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       if (diff < (used_delay / (double)1000000)) {
-                               torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                               "(write time update delay == %.2f) (wrong!)\n",
-                                               diff, used_delay / (double)1000000);
-                               ret = false;
-                               break;
-                       }
-
-                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
-                                       "(correct)\n",
-                                       diff);
-                       break;
-               }
-               smb_msleep(0.5 * msec);
-       }
-
-       GET_INFO_FILE(finfo1);
-       COMPARE_WRITE_TIME_GREATER(finfo1, finfo0);
-
-       /* sure any further write doesn't update the write time */
-       start = timeval_current();
-       end = timeval_add(&start, 15 * sec, 0);
-       while (!timeval_expired(&end)) {
-               /* do a write */
-               torture_comment(tctx, "Do a write on the file handle\n");
-               ZERO_STRUCT(wr);
-               wr.in.file.handle = *h;
-               wr.in.offset      = 0;
-               wr.in.data        = data_blob_const("x", 1);
-               status = smb2_write(tree, &wr);
-               CHECK_STATUS(status, NT_STATUS_OK);
-               written = wr.out.nwritten;
-               if (written != 1) {
-                       torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written);
-                       ret = false;
-                       goto done;
-               }
-               /* get the times after the write */
-               GET_INFO_FILE(finfo2);
-
-               if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) {
-                       double diff = timeval_elapsed(&start);
-                       torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds "
-                                       "(wrong!)\n",
-                                       diff);
-                       ret = false;
-                       break;
-               }
-               smb_msleep(1 * msec);
-       }
-
-       GET_INFO_FILE(finfo2);
-       COMPARE_WRITE_TIME_EQUAL(finfo2, finfo1);
-       if (finfo2.basic_info.out.write_time == finfo1.basic_info.out.write_time) {
-               torture_comment(tctx, "Server did not update write_time (correct)\n");
-       }
-
-       /* sleep */
-       smb_msleep(5 * msec);
-
-       GET_INFO_FILE(finfo3);
-       COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
-
-       /*
-        * the close updates the write time to the time of the close
-        * and not to the time of the last write!
-        */
-       torture_comment(tctx, "Close the file handle\n");
-
-       ZERO_STRUCT(cl);
-       cl.in.file.handle = *h;
-       cl.in.flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION;
-       status = smb2_close(tree, &cl);
-       CHECK_STATUS(status, NT_STATUS_OK);
-       h = NULL;
-               //struct {
-               //      /* static body buffer 60 (0x3C) bytes */
-               //      /* uint16_t buffer_code;  0x3C */
-               //      uint16_t flags;
-               //      uint32_t _pad;
-               //      NTTIME   create_time;
-               //      NTTIME   access_time;
-               //      NTTIME   write_time;
-               //      NTTIME   change_time;
-               //      uint64_t alloc_size;
-               //      uint64_t size;
-               //      uint32_t file_attr;
-               //} out;
-
-       //if (pinfo4.basic_info.out.write_time > pinfo3.basic_info.out.write_time) {
-       //      torture_comment(tctx, "Server updated the write_time on close (correct)\n");
-       //}
-       ///* try a durable reconnect while the file is still open */
-       //ZERO_STRUCT(io);
-       //io.in.fname = "";
-       //io.in.durable_handle_v2 = h;
-       //io.in.create_guid = create_guid;
-       //status = smb2_create(tree, mem_ctx, &io);
-       //CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
-
-done:
-       if (h != NULL) {
-               smb2_util_close(tree, *h);
-       }
-
-       smb2_util_unlink(tree, fname);
-
-       talloc_free(tree);
-
-       talloc_free(mem_ctx);
-
-       return ret;
-}
-
 struct torture_suite *torture_smb2_durable_v2_open_init(TALLOC_CTX *ctx)
 {
        struct torture_suite *suite =
@@ -2698,7 +2030,6 @@ struct torture_suite *torture_smb2_durable_v2_open_init(TALLOC_CTX *ctx)
        torture_suite_add_2smb2_test(suite, "app-instance", test_durable_v2_open_app_instance);
        torture_suite_add_1smb2_test(suite, "persistent-open-oplock", test_persistent_open_oplock);
        torture_suite_add_1smb2_test(suite, "persistent-open-lease", test_persistent_open_lease);
-       torture_suite_add_1smb2_test(suite, "delaywrite1", test_durable_v2_delaywrite1);
 
        suite->description = talloc_strdup(suite, "SMB2-DURABLE-V2-OPEN tests");