cifs-load-gen (cifs_bm) failure-analysis improvements

Yuval Yeret yuvaly at disksites.com
Tue Feb 7 12:05:26 GMT 2006



> -----Original Message-----
> From: Andrew Bartlett [mailto:abartlet at samba.org]
> Sent: Tuesday, February 07, 2006 1:33 PM
> To: Yuval Yeret
> Cc: samba-technical at lists.samba.org
> Subject: Re: cifs-load-gen (cifs_bm) failure-analysis improvements
> 
> On Tue, 2006-02-07 at 10:50 +0200, Yuval Yeret wrote:
> 
> Your mail client seems to be munging on the patch.  Could you resend
in
> diff -u format, and check how to avoid it adding all the newlines?
> (possibly send as an attachment?).
Sending as diff -u attachment and trying to add it in the end without
munging.

> You should also exclude proto.h from the diff, as it is autogenerated.
Well, that is what I was used to in the samba source code, but it
appears the cifs-load-gen system is impaired, and proto.h there is
static. Anyhow, since the diff there can indeed be autogenerated from
the nbio.c code, it can be discarded.

Yuval




--- cifs-load-gen.orig/source/include/proto.h	2002-07-26
00:00:00.000000000 +0300
+++ cifs-load-gen/source/include/proto.h	2006-02-07
13:58:38.000000000 +0200
@@ -277,22 +277,22 @@
 double nbio_total(void);
 void nb_alarm(int dummy);
 void nbio_shmem(int n);
-void nb_setup(struct cli_state *cli);
-void nb_unlink(char *fname);
-void nb_createx(char *fname, 
+int nb_setup(struct cli_state *cli);
+int nb_unlink(char *fname);
+int nb_createx(char *fname, 
 		unsigned create_options, unsigned create_disposition,
int handle);
-void nb_writex(int handle, int offset, int size, int ret_size);
-void nb_readx(int handle, int offset, int size, int ret_size);
-void nb_close(int handle);
-void nb_rmdir(char *fname);
-void nb_rename(char *old, char *new);
-void nb_qpathinfo(char *fname);
-void nb_qfileinfo(int fnum);
-void nb_qfsinfo(int level);
-void nb_findfirst(char *mask);
-void nb_flush(int fnum);
-void nb_deltree(char *dname);
-void nb_cleanup(void);
+int nb_writex(int handle, int offset, int size, int ret_size);
+int nb_readx(int handle, int offset, int size, int ret_size);
+int nb_close(int handle);
+int nb_rmdir(char *fname);
+int nb_rename(char *old, char *new);
+int nb_qpathinfo(char *fname);
+int nb_qfileinfo(int fnum);
+int nb_qfsinfo(int level);
+int nb_findfirst(char *mask);
+int nb_flush(int fnum);
+int nb_deltree(char *dname);
+int nb_cleanup(void);
 
 /* The following definitions come from torture/nmblib.c  */
 
diff -r -u cifs-load-gen.orig/source/include/smb.h
cifs-load-gen/source/include/smb.h
--- cifs-load-gen.orig/source/include/smb.h	2003-04-17
00:00:00.000000000 +0300
+++ cifs-load-gen/source/include/smb.h	2006-02-07 11:06:39.000000000
+0200
@@ -89,7 +89,7 @@
 
 #define EXIT(status) \
     { child_status[nbio_id] = -1; \
-    exit(status); }
+    return(status); }
 
 /* limiting size of ipc replies */
 #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024))
diff -r -u cifs-load-gen.orig/source/torture/cifs_bm.c
cifs-load-gen/source/torture/cifs_bm.c
--- cifs-load-gen.orig/source/torture/cifs_bm.c	2003-05-12
00:00:00.000000000 +0300
+++ cifs-load-gen/source/torture/cifs_bm.c	2006-02-07
11:06:39.000000000 +0200
@@ -231,7 +231,7 @@
 
 static double create_procs(BOOL (*fn)(int), BOOL *result)
 {
-	int i, status, exited, syncing;
+	int i, status, exited, syncing, t;
 	volatile BOOL *child_status_out;
 	int synccount;
 	int tries = 8;
@@ -284,14 +284,19 @@
 
 			sys_srandom(((int)mypid) ^ ((int)time(NULL)));
 
-			slprintf(myname,sizeof(myname),"CLIENT%d", i);
+            slprintf(myname,sizeof(myname),"CLIENT%d", i);
+
+            t=sys_random() % 10;
+            fprintf(stderr, "%s - Sleeping for %d seconds\n", myname,
t);
+            sleep(t);
+
 
 			/* 
 			 * Some setup ...
 			 */
   
 			cmd_info = (struct cmd_struct *)(proc_cmd_info +
(i * (CMD_MAX_CMD + 1)));
-			fprintf(stderr, "child cmd_info: %0X\n",
cmd_info);
+			fprintf(stderr, "%s - child cmd_info: %0X\n",
myname, cmd_info);
 			for (j = 0; j <= CMD_MAX_CMD; j++) {
 
 			  cmd_info[j].count = 0;
@@ -417,6 +422,7 @@
 	FILE *f;
 	char *params[20];
 	BOOL correct = True;
+    int st;
 
 	cli = current_cli;
 
@@ -435,7 +441,7 @@
 		return False;
 	}
 
-	while (fgets(line, sizeof(line)-1, f)) {
+	while (fgets(line, sizeof(line)-1, f) && st==0) {
 		line_count++;
 
 		line[strlen(line)-1] = 0;
@@ -487,55 +493,62 @@
 		  }
 		} else if (!strcmp(params[0],"NTCreateX")) {
 		  if (cmd_enabled[CMD_NTCREATEX])
-		    nb_createx(params[1], ival(params[2]),
ival(params[3]), 
+		    st=nb_createx(params[1], ival(params[2]),
ival(params[3]), 
 			       ival(params[4]));
 		} else if (!strcmp(params[0],"Close")) {
 		  if (cmd_enabled[CMD_CLOSE])
-		    nb_close(ival(params[1]));
+		    st=nb_close(ival(params[1]));
 		} else if (!strcmp(params[0],"Rename")) {
 		  if (cmd_enabled[CMD_RENAME])
-		    nb_rename(params[1], params[2]);
+		    st=nb_rename(params[1], params[2]);
 		} else if (!strcmp(params[0],"Unlink")) {
 		  if (cmd_enabled[CMD_UNLINK])
-		    nb_unlink(params[1]);
+		    st=nb_unlink(params[1]);
 		} else if (!strcmp(params[0],"Deltree")) {
 		  if (cmd_enabled[CMD_DELTREE])
-		    nb_deltree(params[1]);
+		    st=nb_deltree(params[1]);
 		} else if (!strcmp(params[0],"Rmdir")) {
 		  if (cmd_enabled[CMD_RMDIR])
-		    nb_rmdir(params[1]);
+		    st=nb_rmdir(params[1]);
 		} else if (!strcmp(params[0],"QUERY_PATH_INFORMATION"))
{
 		  if (cmd_enabled[CMD_QUERY_PATH_INFO])
-		    nb_qpathinfo(params[1]);
+		    st=nb_qpathinfo(params[1]);
 		} else if (!strcmp(params[0],"QUERY_FILE_INFORMATION"))
{
 		  if (cmd_enabled[CMD_QUERY_FILE_INFO])
-		    nb_qfileinfo(ival(params[1]));
+		    st=nb_qfileinfo(ival(params[1]));
 		} else if (!strcmp(params[0],"QUERY_FS_INFORMATION")) {
 		  if (cmd_enabled[CMD_QUERY_FS_INFO])
-			nb_qfsinfo(ival(params[1]));
+			st=nb_qfsinfo(ival(params[1]));
 		} else if (!strcmp(params[0],"FIND_FIRST")) {
 		  if (cmd_enabled[CMD_FIND_FIRST])
-		    nb_findfirst(params[1]);
+		    st=nb_findfirst(params[1]);
 		} else if (!strcmp(params[0],"WriteX")) {
 		  if (cmd_enabled[CMD_WRITEX])
-		    nb_writex(ival(params[1]), 
+		    st=nb_writex(ival(params[1]), 
 			      ival(params[2]), ival(params[3]),
ival(params[4]));
 		} else if (!strcmp(params[0],"ReadX")) {
 		  if (cmd_enabled[CMD_READX])
-		    nb_readx(ival(params[1]), 
+		    st=nb_readx(ival(params[1]), 
 			     ival(params[2]), ival(params[3]),
ival(params[4]));
 		} else if (!strcmp(params[0],"Flush")) {
 		  if (cmd_enabled[CMD_FLUSH])
-		    nb_flush(ival(params[1]));
+		    st=nb_flush(ival(params[1]));
 		} else if (!strcmp(params[0],"LockingX")) {
 		  if (cmd_enabled[CMD_LOCKINGX])
-		    nb_lock(ival(params[1]), ival(params[2]),
+		    st=nb_lock(ival(params[1]), ival(params[2]),
 			    ival(params[3]), ival(params[4]),
 			    ival(params[5]), ival(params[6]));
 		} else {
 			printf("Unknown operation %s\n", params[0]);
 			exit(1);
 		}
+
+        if (st!=0) {
+            printf("%s: ERROR: process %ld aborting for %s on command
%s in line %ld\n", 
+                   timestring(0), getpid(), myname, line, line_count);
+            exit(1);
+
+        }
 	}
 	fclose(f);
 
Only in cifs-load-gen.orig/source/torture: CVS
diff -r -u cifs-load-gen.orig/source/torture/nbio.c
cifs-load-gen/source/torture/nbio.c
--- cifs-load-gen.orig/source/torture/nbio.c	2003-04-17
00:00:00.000000000 +0300
+++ cifs-load-gen/source/torture/nbio.c	2006-02-07 11:06:39.000000000
+0200
@@ -161,16 +161,17 @@
 	exit(1);
 }
 
-void nb_setup(struct cli_state *cli)
+int nb_setup(struct cli_state *cli)
 {
 	signal(SIGSEGV, sigsegv);
 	c = cli;
 	start_timer();
 	children[nbio_id].done = 0;
+    return(0);
 }
 
 
-void nb_unlink(char *fname)
+int nb_unlink(char *fname)
 {
         int cmd_time;
 	BOOL status;
@@ -189,10 +190,11 @@
 		       line_count, fname, cli_errstr(c));
 #endif
 	}
+    return(0);
 }
 
 
-void nb_createx(char *fname, 
+int nb_createx(char *fname, 
 		unsigned create_options, unsigned create_disposition,
int handle)
 {
 	int fd, i;
@@ -246,9 +248,10 @@
 	if (ftable[i].name) free(ftable[i].name);
 	ftable[i].name = strdup(path);
 	ftable[i].reads = ftable[i].writes = 0;
+    return(0);
 }
 
-void nb_writex(int handle, int offset, int size, int ret_size)
+int nb_writex(int handle, int offset, int size, int ret_size)
 {
 	int i, cmd_time;
 	BOOL status;
@@ -269,9 +272,10 @@
 
 	children[nbio_id].bytes_out += ret_size;
 	ftable[i].writes++;
+    return(0);
 }
 
-void nb_lock(int handle, int offset, int size, int timeout, unsigned
char locktype, NTSTATUS exp)
+int nb_lock(int handle, int offset, int size, int timeout, unsigned
char locktype, NTSTATUS exp)
 {
         int i, cmd_time;
 	NTSTATUS ret;
@@ -287,9 +291,10 @@
 	  printf("File: %s\n", ftable[i].name);
 	  if (error_exit) EXIT(1);
 	}
+    return(0);
 }
 
-void nb_readx(int handle, int offset, int size, int ret_size)
+int nb_readx(int handle, int offset, int size, int ret_size)
 {
 	int i, ret, cmd_time;
 
@@ -306,9 +311,10 @@
 	}
 	children[nbio_id].bytes_in += ret_size;
 	ftable[i].reads++;
+    return(0);
 }
 
-void nb_close(int handle)
+int nb_close(int handle)
 {
 	int i, ret, cmd_time;
 	i = find_handle(handle);
@@ -326,9 +332,10 @@
 	else
 		children[nbio_id].wo_file_opens++;
 	ftable[i].handle = 0;
+    return(0);
 }
 
-void nb_rmdir(char *fname)
+int nb_rmdir(char *fname)
 {
         int ret, cmd_time;
 	pstring path;
@@ -345,9 +352,10 @@
 		       fname, cli_errstr(c));
 		if (error_exit) EXIT(1);
 	}
+    return(0);
 }
 
-void nb_rename(char *old, char *new)
+int nb_rename(char *old, char *new)
 {
         int ret, cmd_time;
 	pstring opath, npath;
@@ -366,10 +374,11 @@
 		       old, new, cli_errstr(c));
 		if (error_exit) EXIT(1);
 	}
+    return(0);
 }
 
 
-void nb_qpathinfo(char *fname)
+int nb_qpathinfo(char *fname)
 {
         int cmd_time;
 	pstring path;
@@ -380,24 +389,27 @@
 	start_cmd_timer();
 	cli_qpathinfo(c, path, NULL, NULL, NULL, NULL, NULL);
 	END_TIME(CMD_QUERY_PATH_INFO)
+    return(0);
 }
 
-void nb_qfileinfo(int fnum)
+int nb_qfileinfo(int fnum)
 {
 	int i, cmd_time;
 	i = find_handle(fnum);
 	start_cmd_timer();
 	cli_qfileinfo(c, ftable[i].fd, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
 	END_TIME(CMD_QUERY_FILE_INFO)
+    return(0);
 }
 
-void nb_qfsinfo(int level)
+int nb_qfsinfo(int level)
 {
 	int bsize, total, avail, cmd_time;
 	/* this is not the right call - we need cli_qfsinfo() */
 	start_cmd_timer();
 	cli_dskattr(c, &bsize, &total, &avail);
 	END_TIME(CMD_QUERY_FS_INFO)
+    return(0);
 }
 
 static void find_fn(file_info *finfo, const char *name, void *state)
@@ -405,19 +417,21 @@
 	/* noop */
 }
 
-void nb_findfirst(char *mask)
+int nb_findfirst(char *mask)
 {
         int cmd_time;
 
 	start_cmd_timer();
 	cli_list(c, mask, 0, find_fn, NULL);
 	END_TIME(CMD_FIND_FIRST)
+    return(0);
 }
 
-void nb_flush(int fnum)
+int nb_flush(int fnum)
 {
 	int i, cmd_time;
 	i = find_handle(fnum);
+    return(0);
 	/* hmmm, we don't have cli_flush() yet */
 }
 
@@ -450,7 +464,7 @@
 	free(n);
 }
 
-void nb_deltree(char *dname)
+int nb_deltree(char *dname)
 {
 	char mask[1024];
 	int cmd_time;
@@ -468,11 +482,14 @@
 	END_TIME(CMD_RMDIR)
 
 	if (total_deleted) printf("WARNING: Cleaned up %d files\n",
total_deleted);
+    return(0);
 }
 
 
-void nb_cleanup(void)
+int nb_cleanup(void)
 {
 	cli_rmdir(c, "clients");
 	children[nbio_id].done = 1;
+    return(0);
+
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cifs_bm.informative.patch
Type: application/octet-stream
Size: 10408 bytes
Desc: cifs_bm.informative.patch
Url : http://lists.samba.org/archive/samba-technical/attachments/20060207/9f5b0977/cifs_bm.informative.obj


More information about the samba-technical mailing list