cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/dlm/tests/usertest dlmtest2.c
Date: 22 Aug 2007 14:01:10 -0000	[thread overview]
Message-ID: <20070822140110.16687.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2007-08-22 14:01:10

Modified files:
	dlm/tests/usertest: dlmtest2.c 

Log message:
	add new test for deadlocks

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/tests/usertest/dlmtest2.c.diff?cvsroot=cluster&r1=1.8&r2=1.9

--- cluster/dlm/tests/usertest/dlmtest2.c	2007/05/30 19:31:28	1.8
+++ cluster/dlm/tests/usertest/dlmtest2.c	2007/08/22 14:01:09	1.9
@@ -732,6 +732,53 @@
 	printf("ast status: zero %d other %d\n", sts_zero, sts_other);
 }
 
+void dstress(int num)
+{
+	int i, o, op, max_op, skip;
+	unsigned int n, skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops;
+	struct lk *lk;
+
+	n = skips = lock_ops = unlock_ops = unlockf_ops = cancel_ops = 0;
+	sts_eunlock = sts_ecancel = sts_etimedout = sts_edeadlk = sts_eagain = sts_other = sts_zero = 0;
+	bast_unlock = bast_skip = 0;
+
+	noqueue = 0;
+	ignore_bast = 1;
+	quiet = 0;
+
+	while (!stress_stop && n < num) {
+
+		sleep(1);
+
+		process_libdlm();
+
+		if (n && !(n % 60))
+			unlock_all();
+
+		i = rand_int(0, maxn-1);
+		lk = get_lock(i);
+		if (!lk)
+			continue;
+
+		if (lk->wait_ast || lk->grmode > -1) {
+			printf("%8x: lock    %3d\t%x: skip gr %d wait_ast %d\n",
+				n, i, lk->lksb.sb_lkid, lk->grmode, lk->wait_ast);
+			continue;
+		}
+
+		lock(i, rand_int(0, 5));
+		lock_ops++;
+		printf("%8x: lock    %3d\t%x\n", n, i, lk->lksb.sb_lkid);
+	}
+
+	printf("ops: skip %d lock %d unlock %d unlockf %d cancel %d\n",
+		skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops);
+	printf("bast: unlock %u skip %u\n", bast_unlock, bast_skip);
+	printf("ast status: eunlock %d ecancel %d etimedout %d edeadlk %d eagain %d\n",
+		sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain);
+	printf("ast status: zero %d other %d\n", sts_zero, sts_other);
+}
+
 void stress(int num)
 {
 	int i, o, op, max_op, skip;
@@ -913,6 +960,7 @@
 	printf("purge nodeid pid - purge orphan locks of process\n");
 	printf("stress n	 - loop doing random lock/unlock/unlockf/cancel on all locks, n times\n");
 	printf("tstress n	 - stress timeouts\n");
+	printf("dstress n	 - stress deadlock\n");
 	printf("timeout n	 - enable lock timeouts, set timeout to n seconds\n");
 	printf("dump		 - show info for all locks\n");
 	printf("minhold		 - set minimum number of seconds locks will be held\n");
@@ -921,6 +969,7 @@
 	printf("persistent	 - toggle PERSISTENT flag for all requests\n");
 	printf("quiet		 - toggle quiet flag\n");
 	printf("verbose		 - toggle verbose flag\n");
+	printf("settings	 - show settings\n");
 
 	printf("\ncombined operations\n");
 	printf("hold-kill                     - hold; kill\n");
@@ -950,6 +999,7 @@
 	printf("stress_stop %d\n", stress_stop);
 	printf("stress_delay %d\n", stress_delay);
 	printf("stress_lock_only %d\n", stress_lock_only);
+	printf("our_xid %x\n", (unsigned long long)our_xid);
 }
 
 void process_command(int *quit)
@@ -1086,6 +1136,11 @@
 		return;
 	}
 
+	if (!strncmp(cmd, "dstress", 7) && strlen(cmd) == 7) {
+		dstress(x);
+		return;
+	}
+
 	if (!strncmp(cmd, "stress_delay", 12) && strlen(cmd) == 12) {
 		stress_delay = x;
 		return;
@@ -1097,12 +1152,25 @@
 		return;
 	}
 
+	if (!strncmp(cmd, "stress_stop", 11) && strlen(cmd) == 11) {
+		stress_stop = !stress_stop;
+		printf("stress_stop is %d\n", stress_stop);
+		return;
+	}
+
 	if (!strncmp(cmd, "ignore_bast", 11) && strlen(cmd) == 11) {
 		ignore_bast = !ignore_bast;
 		printf("ignore_bast is %s\n", ignore_bast ? "on" : "off");
 		return;
 	}
 
+	if (!strncmp(cmd, "our_xid", 7) && strlen(cmd) == 7) {
+		our_xid = x;
+		printf("our_xid is %llx\n", (unsigned long long)our_xid);
+		return;
+	}
+
+
 	if (!strncmp(cmd, "purge", 5) && strlen(cmd) == 5) {
 		purge(x, y);
 		return;



             reply	other threads:[~2007-08-22 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 14:01 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-21 17:49 [Cluster-devel] cluster/dlm/tests/usertest dlmtest2.c teigland
2008-01-17 21:49 teigland
2007-08-23 19:13 teigland
2007-05-30 19:31 teigland
2007-04-27 19:09 teigland
2007-03-27 19:04 teigland
2007-02-27 18:55 teigland
2007-01-04 20:34 teigland
2006-12-12 21:17 teigland
2006-12-08 19:25 teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070822140110.16687.qmail@sourceware.org \
    --to=teigland@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).