The branch, master has been updated
       via  108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8 (commit)
       via  9d95f8704d4dab70d50290ebd1e3c0b8800261a7 (commit)
      from  c57b32c5ab754cdf99527e4dfc4bb6ff3ca93e25 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8
Author: Zack Kirsch <[email protected]>
Date:   Wed Apr 1 17:46:40 2009 -0700

    s4 torture: Addition to RAW-BENCH-LOCK to take a configurable number of 
locks before starting the test
    
    This can be useful for benchmarking as well as stress testing.

commit 9d95f8704d4dab70d50290ebd1e3c0b8800261a7
Author: Zach Loafman <[email protected]>
Date:   Wed Apr 1 11:06:51 2009 -0700

    s/NT_STATUS_WIN7_INVALID_RANGE/NT_STATUS_INVALID_LOCK_RANGE/g

-----------------------------------------------------------------------

Summary of changes:
 libcli/util/ntstatus.h          |    4 ++--
 source4/libcli/util/nterr.c     |    2 +-
 source4/torture/raw/lock.c      |    4 ++--
 source4/torture/raw/lockbench.c |   20 +++++++++++++++++++-
 source4/torture/smb2/lock.c     |   10 +++++-----
 5 files changed, 29 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h
index 1608e28..a97ef53 100644
--- a/libcli/util/ntstatus.h
+++ b/libcli/util/ntstatus.h
@@ -60,8 +60,8 @@ typedef uint32_t NTSTATUS;
 #define ERROR_INSUFFICIENT_BUFFER        NT_STATUS(0x007a)
 #define ERROR_INVALID_DATATYPE           NT_STATUS(0x070c)
 
-/* XXX Win7 Status code: Name unknown. */
-#define NT_STATUS_WIN7_INVALID_RANGE NT_STATUS(0xC0000000 | 0x01a1)
+/* Win7 status codes. */
+#define NT_STATUS_INVALID_LOCK_RANGE      NT_STATUS(0xC0000000 | 0x01a1)
 
 /* Win32 Error codes extracted using a loop in smbclient then printing a
    netmon sniff to a file. */
diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c
index 7f544b5..c196433 100644
--- a/source4/libcli/util/nterr.c
+++ b/source4/libcli/util/nterr.c
@@ -549,7 +549,7 @@ static const nt_err_code_struct nt_errs[] =
        { "NT_STATUS_OBJECTID_NOT_FOUND", NT_STATUS_OBJECTID_NOT_FOUND },
        { "NT_STATUS_DOWNGRADE_DETECTED", NT_STATUS_DOWNGRADE_DETECTED },
        { "NT_STATUS_DS_BUSY", NT_STATUS_DS_BUSY },
-       { "XXX_INVALID_RANGE", NT_STATUS_WIN7_INVALID_RANGE },
+       { "NT_STATUS_INVALID_LOCK_RANGE", NT_STATUS_INVALID_LOCK_RANGE },
        { "STATUS_MORE_ENTRIES", STATUS_MORE_ENTRIES },
        { "STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED },
        { "STATUS_NOTIFY_CLEANUP", STATUS_NOTIFY_CLEANUP },
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index 72a03e1..7e3ac29 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -364,7 +364,7 @@ static bool test_lockx(struct torture_context *tctx, struct 
smbcli_state *cli)
        lock[0].count = 2;
        status = smb_raw_lock(cli->tree, &io);
        if (TARGET_IS_WIN7(tctx))
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        else
                CHECK_STATUS(status, NT_STATUS_OK);
        lock[0].pid--;
@@ -376,7 +376,7 @@ static bool test_lockx(struct torture_context *tctx, struct 
smbcli_state *cli)
        /* XXX This is very strange - Win7 gives us an invalid range when we
         * unlock the range even though the range is locked! Win7 bug? */
        if (TARGET_IS_WIN7(tctx))
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        else {
                CHECK_STATUS(status, NT_STATUS_OK);
                status = smb_raw_lock(cli->tree, &io);
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index d20175a..c7f99ae 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -317,13 +317,15 @@ bool torture_bench_lock(struct torture_context *torture)
 {
        bool ret = true;
        TALLOC_CTX *mem_ctx = talloc_new(torture);
-       int i;
+       int i, j;
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        struct timeval tv;
        struct benchlock_state *state;
        int total = 0, minops=0;
        struct smbcli_state *cli;
        bool progress;
+       off_t offset;
+       int initial_locks = torture_setting_int(torture, "initial_locks", 0);
 
        progress = torture_setting_bool(torture, "progress", true);
 
@@ -371,6 +373,21 @@ bool torture_bench_lock(struct torture_context *torture)
                        goto failed;
                }
 
+               /* Optionally, lock initial_locks for each proc beforehand. */
+               if (i == 0 && initial_locks > 0) {
+                       printf("Initializing %d locks on each proc.\n",
+                           initial_locks);
+               }
+
+               for (j = 0; j < initial_locks; j++) {
+                       offset = (0xFFFFFED8LLU * (i+2)) + j;
+                       if (!NT_STATUS_IS_OK(smbcli_lock64(state[i].tree,
+                           state[i].fnum, offset, 1, 0, WRITE_LOCK))) {
+                               printf("Failed initializing, lock=%d\n", j);
+                               goto failed;
+                       }
+               }
+
                state[i].stage = LOCK_INITIAL;
                lock_send(&state[i]);
        }
@@ -413,6 +430,7 @@ bool torture_bench_lock(struct torture_context *torture)
        return ret;
 
 failed:
+       smbcli_deltree(state[0].tree, BASEDIR);
        talloc_free(mem_ctx);
        return false;
 }
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 5f0293c..844309e 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -101,7 +101,7 @@ static bool test_valid_request(struct torture_context 
*torture, struct smb2_tree
        el[0].flags             = 
SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
        status = smb2_lock(tree, &lck);
        if (TARGET_IS_WIN7(torture)) {
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        } else {
                CHECK_STATUS(status, NT_STATUS_OK);
        }
@@ -110,7 +110,7 @@ static bool test_valid_request(struct torture_context 
*torture, struct smb2_tree
        lck.in.reserved         = 0x123ab2;
        status = smb2_lock(tree, &lck);
        if (TARGET_IS_WIN7(torture)) {
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        } else {
                CHECK_STATUS(status, NT_STATUS_OK);
        }
@@ -118,7 +118,7 @@ static bool test_valid_request(struct torture_context 
*torture, struct smb2_tree
        lck.in.reserved         = 0x123ab3;
        status = smb2_lock(tree, &lck);
        if (TARGET_IS_WIN7(torture)) {
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        } else if (TARGET_IS_WINDOWS(torture)) {
                CHECK_STATUS(status, NT_STATUS_OK);
        } else {
@@ -129,7 +129,7 @@ static bool test_valid_request(struct torture_context 
*torture, struct smb2_tree
        lck.in.reserved         = 0x123ab4;
        status = smb2_lock(tree, &lck);
        if (TARGET_IS_WIN7(torture)) {
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        } else {
                CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
        }
@@ -137,7 +137,7 @@ static bool test_valid_request(struct torture_context 
*torture, struct smb2_tree
        lck.in.reserved         = 0x123ab5;
        status = smb2_lock(tree, &lck);
        if (TARGET_IS_WIN7(torture)) {
-               CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE);
+               CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        } else if (TARGET_IS_WINDOWS(torture)) {
                CHECK_STATUS(status, NT_STATUS_OK);
        } else {


-- 
Samba Shared Repository

Reply via email to