torture: Extend the raw.oplock.level_ii_1 test
authorVolker Lendecke <vl@samba.org>
Wed, 16 Oct 2013 19:34:15 +0000 (21:34 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 23 Oct 2013 12:06:12 +0000 (14:06 +0200)
smbd broke to none twice. Make sure this won't happen again :-)

This used to happen before the MSG_SMB_BREAK_RESPONSE merge. In
process_oplock_break_message we did not call remove_oplock, which would
have prevented this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 23 14:06:13 CEST 2013 on sn-devel-104

source4/torture/raw/oplock.c

index 26baabc..a4f6a05 100644 (file)
@@ -1074,6 +1074,8 @@ static bool test_raw_oplock_level_ii_1(struct torture_context *tctx,
        bool ret = true;
        union smb_open io;
        uint16_t fnum=0, fnum2=0;
+       char c = 0;
+       ssize_t written;
 
        if (!torture_setup_dir(cli1, BASEDIR)) {
                return false;
@@ -1156,6 +1158,18 @@ static bool test_raw_oplock_level_ii_1(struct torture_context *tctx,
        CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
        CHECK_VAL(break_info.failures, 0);
 
+       /*
+        * Check that a write does not cause another break. This used to be a
+        * bug in smbd.
+        */
+
+       ZERO_STRUCT(break_info);
+       written = smbcli_write(cli2->tree, fnum2, 0, &c, 0, 1);
+       CHECK_VAL(written, 1);
+       torture_wait_for_oplock_break(tctx);
+       CHECK_VAL(break_info.count, 0);
+       CHECK_VAL(break_info.failures, 0);
+
        status = smbcli_close(cli2->tree, fnum2);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
        status = smbcli_close(cli1->tree, fnum);