torture: Reproducer for 64c0367
authorVolker Lendecke <vl@samba.org>
Tue, 7 Aug 2012 15:12:19 +0000 (17:12 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 10 Aug 2012 21:38:47 +0000 (14:38 -0700)
Signed-off-by: Jeremy Allison <jra@samba.org>
source4/torture/raw/lock.c

index c2e555147bba8c26cdb47c4707460fbe381a5b61..a31a4d0cfb1f5e8c725adcae2fdbac070cd6668f 100644 (file)
@@ -773,8 +773,19 @@ static bool test_async(struct torture_context *tctx,
        status = smb_raw_lock(cli->tree, &io);
        CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
 
+       {
+               /*
+                * Make the test block on the second lock
+                * request. This is to regression-test 64c0367.
+                */
+               uint64_t tmp = lock[1].offset;
+               lock[1].offset = lock[0].offset;
+               lock[0].offset = tmp;
+       }
+
        t = time_mono(NULL);
        io.lockx.in.timeout = 10000;
+       io.lockx.in.lock_cnt = 2;
        req = smb_raw_lock_send(cli->tree, &io);
        torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
                       "Failed to setup timed lock (%s)\n", __location__));
@@ -791,6 +802,15 @@ static bool test_async(struct torture_context *tctx,
        torture_assert(tctx,!(time_mono(NULL) > t+2), talloc_asprintf(tctx,
                       "lock cancel by close was not immediate (%s)\n", __location__));
 
+       {
+               /*
+                * Undo the change for 64c0367
+                */
+               uint64_t tmp = lock[1].offset;
+               lock[1].offset = lock[0].offset;
+               lock[0].offset = tmp;
+       }
+
        torture_comment(tctx, "create a new sessions\n");
        session = smbcli_session_init(cli->transport, tctx, false, options);
        setup.in.sesskey = cli->transport->negotiate.sesskey;