2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 1997-2003
5 Copyright (C) Jelmer Vernooij 2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "libcli/raw/libcliraw.h"
24 #include "system/time.h"
25 #include "system/wait.h"
26 #include "system/filesys.h"
27 #include "libcli/raw/ioctl.h"
28 #include "libcli/libcli.h"
29 #include "lib/events/events.h"
30 #include "libcli/resolve/resolve.h"
31 #include "auth/credentials/credentials.h"
32 #include "librpc/gen_ndr/ndr_nbt.h"
33 #include "torture/torture.h"
34 #include "torture/util.h"
35 #include "libcli/smb_composite/smb_composite.h"
36 #include "libcli/composite/composite.h"
38 extern struct cli_credentials *cmdline_credentials;
39 static void benchrw_callback(struct smbcli_request *req);
56 struct torture_context *tctx;
61 struct smbcli_tree *cli;
68 enum benchrw_stage mode;
74 const char *workgroup;
76 unsigned int writeblocks;
77 unsigned int blocksize;
78 unsigned int writeratio;
82 static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
84 while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
85 if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False;
91 static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c)
93 const char *lockfname = "\\torture.lck";
97 pid_t pid2, pid = getpid();
102 fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
105 fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
107 torture_comment(tctx, "open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree));
112 for (i=0;i<torture_numops;i++) {
113 uint_t n = (uint_t)random()%10;
115 torture_comment(tctx, "%d\r", i); fflush(stdout);
117 asprintf(&fname, "\\torture.%u", n);
119 if (!wait_lock(c, fnum2, n*sizeof(int), sizeof(int))) {
123 fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
125 torture_comment(tctx, "open failed (%s)\n", smbcli_errstr(c->tree));
130 if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) {
131 torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree));
136 if (smbcli_write(c->tree, fnum, 0, buf,
137 sizeof(pid)+(j*sizeof(buf)),
138 sizeof(buf)) != sizeof(buf)) {
139 torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree));
146 if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) {
147 torture_comment(tctx, "read failed (%s)\n", smbcli_errstr(c->tree));
152 torture_comment(tctx, "data corruption!\n");
156 if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
157 torture_comment(tctx, "close failed (%s)\n", smbcli_errstr(c->tree));
161 if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) {
162 torture_comment(tctx, "unlink failed (%s)\n", smbcli_errstr(c->tree));
166 if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
167 torture_comment(tctx, "unlock failed (%s)\n", smbcli_errstr(c->tree));
173 smbcli_close(c->tree, fnum2);
174 smbcli_unlink(c->tree, lockfname);
176 torture_comment(tctx, "%d\n", i);
181 BOOL run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dummy)
183 return rw_torture(tctx, cli);
188 see how many RPC pipes we can open at once
190 BOOL run_pipe_number(struct torture_context *tctx,
191 struct smbcli_state *cli1)
193 const char *pipe_name = "\\WKSSVC";
198 fnum = smbcli_nt_create_full(cli1->tree, pipe_name, 0, SEC_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
199 NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN_IF, 0, 0);
202 torture_comment(tctx, "Open of pipe %s failed with error (%s)\n", pipe_name, smbcli_errstr(cli1->tree));
206 torture_comment(tctx, "%d\r", num_pipes);
210 torture_comment(tctx, "pipe_number test - we can open %d %s pipes.\n", num_pipes, pipe_name );
218 open N connections to the server and just hold them open
219 used for testing performance when there are N idle users
222 BOOL torture_holdcon(struct torture_context *tctx)
225 struct smbcli_state **cli;
228 torture_comment(tctx, "Opening %d connections\n", torture_numops);
230 cli = malloc_array_p(struct smbcli_state *, torture_numops);
232 for (i=0;i<torture_numops;i++) {
233 if (!torture_open_connection(&cli[i], i)) {
236 torture_comment(tctx, "opened %d connections\r", i);
240 torture_comment(tctx, "\nStarting pings\n");
243 for (i=0;i<torture_numops;i++) {
246 status = smbcli_chkpath(cli[i]->tree, "\\");
247 if (!NT_STATUS_IS_OK(status)) {
248 torture_comment(tctx, "Connection %d is dead\n", i);
256 if (num_dead == torture_numops) {
257 torture_comment(tctx, "All connections dead - finishing\n");
261 torture_comment(tctx, ".");
269 test how many open files this server supports on the one socket
271 BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int dummy)
273 #define MAXFID_TEMPLATE "\\maxfid\\fid%d\\maxfid.%d.%d"
275 int fnums[0x11000], i;
276 int retries=4, maxfid;
280 torture_comment(tctx, "failed to connect\n");
284 if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
285 torture_comment(tctx, "Failed to deltree \\maxfid - %s\n",
286 smbcli_errstr(cli->tree));
289 if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\maxfid"))) {
290 torture_comment(tctx, "Failed to mkdir \\maxfid, error=%s\n",
291 smbcli_errstr(cli->tree));
295 torture_comment(tctx, "Testing maximum number of open files\n");
297 for (i=0; i<0x11000; i++) {
299 asprintf(&fname, "\\maxfid\\fid%d", i/1000);
300 if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) {
301 torture_comment(tctx, "Failed to mkdir %s, error=%s\n",
302 fname, smbcli_errstr(cli->tree));
307 asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
308 if ((fnums[i] = smbcli_open(cli->tree, fname,
309 O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) ==
311 torture_comment(tctx, "open of %s failed (%s)\n",
312 fname, smbcli_errstr(cli->tree));
313 torture_comment(tctx, "maximum fnum is %d\n", i);
317 torture_comment(tctx, "%6d\r", i);
319 torture_comment(tctx, "%6d\n", i);
324 torture_comment(tctx, "cleaning up\n");
325 for (i=0;i<maxfid/2;i++) {
326 asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
327 if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[i]))) {
328 torture_comment(tctx, "Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree));
330 if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
331 torture_comment(tctx, "unlink of %s failed (%s)\n",
332 fname, smbcli_errstr(cli->tree));
337 asprintf(&fname, MAXFID_TEMPLATE, (maxfid-i)/1000, maxfid-i,(int)getpid());
338 if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[maxfid-i]))) {
339 torture_comment(tctx, "Close of fnum %d failed - %s\n", fnums[maxfid-i], smbcli_errstr(cli->tree));
341 if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
342 torture_comment(tctx, "unlink of %s failed (%s)\n",
343 fname, smbcli_errstr(cli->tree));
348 torture_comment(tctx, "%6d %6d\r", i, maxfid-i);
350 torture_comment(tctx, "%6d\n", 0);
352 if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
353 torture_comment(tctx, "Failed to deltree \\maxfid - %s\n",
354 smbcli_errstr(cli->tree));
358 torture_comment(tctx, "maxfid test finished\n");
359 if (!torture_close_connection(cli)) {
363 #undef MAXFID_TEMPLATE
369 sees what IOCTLs are supported
371 BOOL torture_ioctl_test(struct torture_context *tctx,
372 struct smbcli_state *cli)
374 uint16_t device, function;
376 const char *fname = "\\ioctl.dat";
378 union smb_ioctl parms;
381 mem_ctx = talloc_named_const(tctx, 0, "ioctl_test");
383 smbcli_unlink(cli->tree, fname);
385 fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
387 torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
391 parms.ioctl.level = RAW_IOCTL_IOCTL;
392 parms.ioctl.in.file.fnum = fnum;
393 parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
394 status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
395 torture_comment(tctx, "ioctl job info: %s\n", smbcli_errstr(cli->tree));
397 for (device=0;device<0x100;device++) {
398 torture_comment(tctx, "testing device=0x%x\n", device);
399 for (function=0;function<0x100;function++) {
400 parms.ioctl.in.request = (device << 16) | function;
401 status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
403 if (NT_STATUS_IS_OK(status)) {
404 torture_comment(tctx, "ioctl device=0x%x function=0x%x OK : %d bytes\n",
405 device, function, (int)parms.ioctl.out.blob.length);
414 init params using lp_parm_xxx
415 return number of unclist entries
417 static int init_benchrw_params(struct torture_context *tctx, struct params *lpar)
419 char **unc_list = NULL;
420 int num_unc_names = 0, conn_index=0, empty_lines=0;
422 lpar->retry = torture_setting_int(tctx, "retry",3);
423 lpar->blocksize = torture_setting_int(tctx, "blocksize",65535);
424 lpar->writeblocks = torture_setting_int(tctx, "writeblocks",15);
425 lpar->writeratio = torture_setting_int(tctx, "writeratio",5);
426 lpar->workgroup = lp_workgroup();
428 p = torture_setting_string(tctx, "unclist", NULL);
431 unc_list = file_lines_load(p, &num_unc_names, NULL);
432 if (!unc_list || num_unc_names <= 0) {
433 torture_comment(tctx, "Failed to load unc names list from '%s'\n", p);
437 lpar->unc = talloc_array(tctx, struct unclist *, (num_unc_names-empty_lines));
438 for(conn_index = 0; conn_index < num_unc_names; conn_index++) {
439 /* ignore empty lines */
440 if(strlen(unc_list[conn_index % num_unc_names])==0){
444 if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names],
446 torture_comment(tctx, "Failed to parse UNC name %s\n",
447 unc_list[conn_index % num_unc_names]);
450 lpar->unc[conn_index-empty_lines] = talloc(tctx,struct unclist);
451 lpar->unc[conn_index-empty_lines]->host = h;
452 lpar->unc[conn_index-empty_lines]->share = s;
454 return num_unc_names-empty_lines;
456 lpar->unc = talloc_array(tctx, struct unclist *, 1);
457 lpar->unc[0] = talloc(tctx,struct unclist);
458 lpar->unc[0]->host = torture_setting_string(tctx, "host", NULL);
459 lpar->unc[0]->share = torture_setting_string(tctx, "share", NULL);
465 Called when the reads & writes are finished. closes the file.
467 static NTSTATUS benchrw_close(struct torture_context *tctx,struct smbcli_request *req,
468 struct benchrw_state *state)
470 union smb_close close_parms;
472 NT_STATUS_NOT_OK_RETURN(req->status);
474 torture_comment(tctx, "Close file %d (%d)\n",state->nr,state->fnum);
475 close_parms.close.level = RAW_CLOSE_CLOSE;
476 close_parms.close.in.file.fnum = state->fnum ;
477 close_parms.close.in.write_time = 0;
478 state->mode=CLOSE_FILE;
480 req = smb_raw_close_send(state->cli, &close_parms);
481 NT_STATUS_HAVE_NO_MEMORY(req);
482 /*register the callback function!*/
483 req->async.fn = benchrw_callback;
484 req->async.private = state;
490 Called when the initial write is completed is done. write or read a file.
492 static NTSTATUS benchrw_readwrite(struct torture_context *tctx,struct smbcli_request *req,
493 struct benchrw_state *state)
498 NT_STATUS_NOT_OK_RETURN(req->status);
501 /*rotate between writes and reads*/
502 if( state->completed % state->lp_params->writeratio == 0){
503 torture_comment(tctx, "Callback WRITE file:%d (%d/%d)\n",
504 state->nr,state->completed,torture_numops);
505 wr.generic.level = RAW_WRITE_WRITEX ;
506 wr.writex.in.file.fnum = state->fnum ;
507 wr.writex.in.offset = 0;
508 wr.writex.in.wmode = 0 ;
509 wr.writex.in.remaining = 0;
510 wr.writex.in.count = state->lp_params->blocksize;
511 wr.writex.in.data = state->buffer;
513 req = smb_raw_write_send(state->cli,&wr);
515 torture_comment(tctx, "Callback READ file:%d (%d/%d) Offset:%d\n",
516 state->nr,state->completed,torture_numops,
517 (state->readcnt*state->lp_params->blocksize));
518 rd.generic.level = RAW_READ_READ ;
519 rd.read.in.file.fnum = state->fnum ;
520 rd.read.in.offset = state->readcnt *
521 state->lp_params->blocksize;
522 rd.read.in.count = state->lp_params->blocksize;
523 rd.read.in.remaining = 0 ;
524 rd.read.out.data = state->buffer;
525 if(state->readcnt < state->lp_params->writeblocks){
528 /*start reading from beginn of file*/
531 req = smb_raw_read_send(state->cli,&rd);
533 NT_STATUS_HAVE_NO_MEMORY(req);
534 /*register the callback function!*/
535 req->async.fn = benchrw_callback;
536 req->async.private = state;
542 Called when the open is done. writes to the file.
544 static NTSTATUS benchrw_open(struct torture_context *tctx,struct smbcli_request *req,
545 struct benchrw_state *state)
548 if(state->mode == OPEN_FILE){
550 status = smb_raw_open_recv(req,state->mem_ctx,(
551 union smb_open*)state->req_params);
552 NT_STATUS_NOT_OK_RETURN(status);
554 state->fnum = ((union smb_open*)state->req_params)
555 ->openx.out.file.fnum;
556 torture_comment(tctx, "File opened (%d)\n",state->fnum);
557 state->mode=INITIAL_WRITE;
560 torture_comment(tctx, "Write initial test file:%d (%d/%d)\n",state->nr,
561 (state->writecnt+1)*state->lp_params->blocksize,
562 (state->lp_params->writeblocks*state->lp_params->blocksize));
563 wr.generic.level = RAW_WRITE_WRITEX ;
564 wr.writex.in.file.fnum = state->fnum ;
565 wr.writex.in.offset = state->writecnt *
566 state->lp_params->blocksize;
567 wr.writex.in.wmode = 0 ;
568 wr.writex.in.remaining = (state->lp_params->writeblocks *
569 state->lp_params->blocksize)-
570 ((state->writecnt+1)*state->
571 lp_params->blocksize);
572 wr.writex.in.count = state->lp_params->blocksize;
573 wr.writex.in.data = state->buffer;
575 if(state->writecnt == state->lp_params->writeblocks){
576 state->mode=READ_WRITE_DATA;
578 req = smb_raw_write_send(state->cli,&wr);
579 NT_STATUS_HAVE_NO_MEMORY(req);
581 /*register the callback function!*/
582 req->async.fn = benchrw_callback;
583 req->async.private = state;
588 Called when the mkdir is done. Opens a file.
590 static NTSTATUS benchrw_mkdir(struct torture_context *tctx,struct smbcli_request *req,
591 struct benchrw_state *state)
593 union smb_open *open_parms;
596 NT_STATUS_NOT_OK_RETURN(req->status);
598 /* open/create the files */
599 torture_comment(tctx, "Open File %d/%d\n",state->nr+1,torture_nprocs);
600 open_parms=talloc_zero(state->mem_ctx, union smb_open);
601 NT_STATUS_HAVE_NO_MEMORY(open_parms);
602 open_parms->openx.level = RAW_OPEN_OPENX;
603 open_parms->openx.in.flags = 0;
604 open_parms->openx.in.open_mode = OPENX_MODE_ACCESS_RDWR;
605 open_parms->openx.in.search_attrs =
606 FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
607 open_parms->openx.in.file_attrs = 0;
608 open_parms->openx.in.write_time = 0;
609 open_parms->openx.in.open_func = OPENX_OPEN_FUNC_CREATE;
610 open_parms->openx.in.size = 0;
611 open_parms->openx.in.timeout = 0;
612 open_parms->openx.in.fname = state->fname;
614 writedata = talloc_size(state->mem_ctx,state->lp_params->blocksize);
615 NT_STATUS_HAVE_NO_MEMORY(writedata);
616 generate_random_buffer(writedata,state->lp_params->blocksize);
617 state->buffer=writedata;
620 state->req_params=open_parms;
621 state->mode=OPEN_FILE;
623 req = smb_raw_open_send(state->cli,open_parms);
624 NT_STATUS_HAVE_NO_MEMORY(req);
626 /*register the callback function!*/
627 req->async.fn = benchrw_callback;
628 req->async.private = state;
634 handler for completion of a sub-request of the bench-rw test
636 static void benchrw_callback(struct smbcli_request *req)
638 struct benchrw_state *state = req->async.private;
639 struct torture_context *tctx = state->tctx;
641 /*dont send new requests when torture_numops is reached*/
642 if(state->completed >= torture_numops){
644 state->mode=MAX_OPS_REACHED;
647 switch (state->mode) {
650 if (!NT_STATUS_IS_OK(benchrw_mkdir(tctx, req,state))) {
651 torture_comment(tctx, "Failed to create the test directory - %s\n",
652 nt_errstr(req->status));
659 if (!NT_STATUS_IS_OK(benchrw_open(tctx, req,state))){
660 torture_comment(tctx, "Failed to open/write the file - %s\n",
661 nt_errstr(req->status));
666 case READ_WRITE_DATA:
667 if (!NT_STATUS_IS_OK(benchrw_readwrite(tctx,req,state))){
668 torture_comment(tctx, "Failed to read/write the file - %s\n",
669 nt_errstr(req->status));
674 case MAX_OPS_REACHED:
675 if (!NT_STATUS_IS_OK(benchrw_close(tctx,req,state))){
676 torture_comment(tctx, "Failed to read/write/close the file - %s\n",
677 nt_errstr(req->status));
683 torture_comment(tctx, "File %d closed\n",state->nr);
684 if (!NT_STATUS_IS_OK(req->status)) {
685 torture_comment(tctx, "Failed to close the file - %s\n",
686 nt_errstr(req->status));
698 /* open connection async callback function*/
699 static void async_open_callback(struct composite_context *con)
701 struct benchrw_state *state = con->async.private_data;
702 struct torture_context *tctx = state->tctx;
703 int retry = state->lp_params->retry;
705 if (NT_STATUS_IS_OK(con->status)) {
706 state->cli=((struct smb_composite_connect*)
707 state->req_params)->out.tree;
708 state->mode=CLEANUP_TESTDIR;
710 if(state->writecnt < retry){
711 torture_comment(tctx, "Failed to open connection:%d, Retry (%d/%d)\n",
712 state->nr,state->writecnt,retry);
717 torture_comment(tctx, "Failed to open connection (%d) - %s\n",
718 state->nr, nt_errstr(con->status));
726 establishs a smbcli_tree from scratch (async)
728 static struct composite_context *torture_connect_async(
729 struct torture_context *tctx,
730 struct smb_composite_connect *smb,
732 struct event_context *ev,
735 const char *workgroup)
737 torture_comment(tctx, "Open Connection to %s/%s\n",host,share);
738 smb->in.dest_host=talloc_strdup(mem_ctx,host);
739 smb->in.service=talloc_strdup(mem_ctx,share);
741 smb->in.called_name = strupper_talloc(mem_ctx, host);
742 smb->in.service_type=NULL;
743 smb->in.credentials=cmdline_credentials;
744 smb->in.fallback_to_anonymous=False;
745 smb->in.workgroup=workgroup;
747 return smb_composite_connect_send(smb,mem_ctx,ev);
750 BOOL run_benchrw(struct torture_context *tctx)
752 struct smb_composite_connect *smb_con;
753 const char *fname = "\\rwtest.dat";
754 struct smbcli_request *req;
755 struct benchrw_state **state;
756 int i , num_unc_names;
757 struct event_context *ev ;
758 struct composite_context *req1;
759 struct params lpparams;
760 union smb_mkdir parms;
764 torture_comment(tctx, "Start BENCH-READWRITE num_ops=%d num_nprocs=%d\n",
765 torture_numops,torture_nprocs);
767 /*init talloc context*/
768 ev = event_context_init(tctx);
769 state = talloc_array(tctx, struct benchrw_state *, torture_nprocs);
771 /* init params using lp_parm_xxx */
772 num_unc_names = init_benchrw_params(tctx,&lpparams);
774 /* init private data structs*/
775 for(i = 0; i<torture_nprocs;i++){
776 state[i]=talloc(tctx,struct benchrw_state);
777 state[i]->tctx = tctx;
778 state[i]->completed=0;
779 state[i]->lp_params=&lpparams;
781 state[i]->dname=talloc_asprintf(tctx,"benchrw%d",i);
782 state[i]->fname=talloc_asprintf(tctx,"%s%s",
783 state[i]->dname,fname);
784 state[i]->mode=START;
785 state[i]->writecnt=0;
788 torture_comment(tctx, "Starting async requests\n");
789 while(finished != torture_nprocs){
791 for(i = 0; i<torture_nprocs;i++){
792 switch (state[i]->mode){
793 /*open multiple connections with the same userid */
795 smb_con = talloc(tctx,struct smb_composite_connect) ;
796 state[i]->req_params=smb_con;
797 state[i]->mode=OPEN_CONNECTION;
798 req1 = torture_connect_async(tctx, smb_con,
800 lpparams.unc[i % num_unc_names]->host,
801 lpparams.unc[i % num_unc_names]->share,
803 /* register callback fn + private data */
804 req1->async.fn = async_open_callback;
805 req1->async.private_data=state[i];
807 /*setup test dirs (sync)*/
808 case CLEANUP_TESTDIR:
809 torture_comment(tctx, "Setup test dir %d\n",i);
810 smb_raw_exit(state[i]->cli->session);
811 if (smbcli_deltree(state[i]->cli,
812 state[i]->dname) == -1) {
813 torture_comment(tctx, "Unable to delete %s - %s\n",
815 smbcli_errstr(state[i]->cli));
816 state[i]->mode=ERROR;
819 state[i]->mode=MK_TESTDIR;
820 parms.mkdir.level = RAW_MKDIR_MKDIR;
821 parms.mkdir.in.path = state[i]->dname;
822 req = smb_raw_mkdir_send(state[i]->cli,&parms);
823 /* register callback fn + private data */
824 req->async.fn = benchrw_callback;
825 req->async.private=state[i];
827 /* error occured , finish */
832 /* cleanup , close connection */
834 torture_comment(tctx, "Deleting test dir %s %d/%d\n",state[i]->dname,
836 smbcli_deltree(state[i]->cli,state[i]->dname);
837 if (NT_STATUS_IS_ERR(smb_tree_disconnect(
839 torture_comment(tctx, "ERROR: Tree disconnect failed");
840 state[i]->mode=ERROR;
843 state[i]->mode=FINISHED;