diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-01-14 00:50:48 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-01-14 00:50:48 +0000 |
commit | 2afd5d5eb5c176f09a9f4f00ea3b517e89ef0ddf (patch) | |
tree | e217622062ac847e81b944e1bf111f67c1c75c2a /source3/utils | |
parent | cdb8c99fce9b24d18f664f9ed42062f8a945e395 (diff) | |
download | samba-2afd5d5eb5c176f09a9f4f00ea3b517e89ef0ddf.tar.gz samba-2afd5d5eb5c176f09a9f4f00ea3b517e89ef0ddf.tar.bz2 samba-2afd5d5eb5c176f09a9f4f00ea3b517e89ef0ddf.zip |
some more work on the byte range locking
note the ugly global_smbpid - I hope that won't bethere for long, I
just didn't want to do two lots of major surgery at the one time.
Using global_smbpid avoids the big change of getting rid of our
inbuf/outbuf interface to reply routines. I'll do that once the
locking stuff passes all tests.
(This used to be commit f8bebf91abcaa5bda3ec8701f9242f220da8943a)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/torture.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c index e905216d38..ba510c0b58 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -168,7 +168,7 @@ static BOOL check_error(struct cli_state *c, static BOOL wait_lock(struct cli_state *c, int fnum, uint32 offset, uint32 len) { - while (!cli_lock(c, fnum, offset, len, -1, F_WRLCK)) { + while (!cli_lock(c, fnum, offset, len, -1, WRITE_LOCK)) { if (!check_error(c, ERRDOS, ERRlock, 0)) return False; } return True; @@ -436,13 +436,13 @@ static void run_locktest1(int dummy) return; } - if (!cli_lock(&cli1, fnum1, 0, 4, 0, F_WRLCK)) { + if (!cli_lock(&cli1, fnum1, 0, 4, 0, WRITE_LOCK)) { printf("lock1 failed (%s)\n", cli_errstr(&cli1)); return; } - if (cli_lock(&cli2, fnum3, 0, 4, 0, F_WRLCK)) { + if (cli_lock(&cli2, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock2 succeeded! This is a locking bug\n"); return; } else { @@ -452,7 +452,7 @@ static void run_locktest1(int dummy) printf("Testing lock timeouts\n"); t1 = time(NULL); - if (cli_lock(&cli2, fnum3, 0, 4, 10*1000, F_WRLCK)) { + if (cli_lock(&cli2, fnum3, 0, 4, 10*1000, WRITE_LOCK)) { printf("lock3 succeeded! This is a locking bug\n"); return; } else { @@ -469,7 +469,7 @@ static void run_locktest1(int dummy) return; } - if (cli_lock(&cli2, fnum3, 0, 4, 0, F_WRLCK)) { + if (cli_lock(&cli2, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock4 succeeded! This is a locking bug\n"); return; } else { @@ -550,12 +550,14 @@ static void run_locktest2(int dummy) cli_setpid(&cli, 1); - if (!cli_lock(&cli, fnum1, 0, 4, 0, F_WRLCK)) { + sleep(10); + + if (!cli_lock(&cli, fnum1, 0, 4, 0, WRITE_LOCK)) { printf("lock1 failed (%s)\n", cli_errstr(&cli)); return; } - if (cli_lock(&cli, fnum2, 0, 4, 0, F_WRLCK)) { + if (cli_lock(&cli, fnum2, 0, 4, 0, WRITE_LOCK)) { printf("lock2 succeeded! This is a locking bug\n"); } else { if (!check_error(&cli, ERRDOS, ERRlock, 0)) return; @@ -567,7 +569,7 @@ static void run_locktest2(int dummy) printf("unlock1 succeeded! This is a locking bug\n"); } - if (cli_lock(&cli, fnum3, 0, 4, 0, F_WRLCK)) { + if (cli_lock(&cli, fnum3, 0, 4, 0, WRITE_LOCK)) { printf("lock3 succeeded! This is a locking bug\n"); } else { if (!check_error(&cli, ERRDOS, ERRlock, 0)) return; @@ -633,14 +635,14 @@ static void run_locktest3(int dummy) for (offset=i=0;i<numops;i++) { NEXT_OFFSET; - if (!cli_lock(&cli1, fnum1, offset-1, 1, 0, F_WRLCK)) { + if (!cli_lock(&cli1, fnum1, offset-1, 1, 0, WRITE_LOCK)) { printf("lock1 %d failed (%s)\n", i, cli_errstr(&cli1)); return; } - if (!cli_lock(&cli2, fnum2, offset-2, 1, 0, F_WRLCK)) { + if (!cli_lock(&cli2, fnum2, offset-2, 1, 0, WRITE_LOCK)) { printf("lock2 %d failed (%s)\n", i, cli_errstr(&cli1)); @@ -651,22 +653,22 @@ static void run_locktest3(int dummy) for (offset=i=0;i<numops;i++) { NEXT_OFFSET; - if (cli_lock(&cli1, fnum1, offset-2, 1, 0, F_WRLCK)) { + if (cli_lock(&cli1, fnum1, offset-2, 1, 0, WRITE_LOCK)) { printf("error: lock1 %d succeeded!\n", i); return; } - if (cli_lock(&cli2, fnum2, offset-1, 1, 0, F_WRLCK)) { + if (cli_lock(&cli2, fnum2, offset-1, 1, 0, WRITE_LOCK)) { printf("error: lock2 %d succeeded!\n", i); return; } - if (cli_lock(&cli1, fnum1, offset-1, 1, 0, F_WRLCK)) { + if (cli_lock(&cli1, fnum1, offset-1, 1, 0, WRITE_LOCK)) { printf("error: lock3 %d succeeded!\n", i); return; } - if (cli_lock(&cli2, fnum2, offset-2, 1, 0, F_WRLCK)) { + if (cli_lock(&cli2, fnum2, offset-2, 1, 0, WRITE_LOCK)) { printf("error: lock4 %d succeeded!\n", i); return; } |