summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-09-27 12:59:47 -0400
committerFrans Kaashoek <[email protected]>2011-09-27 12:59:47 -0400
commit9b972c06b172531e5792fc0e05d83319d325e0ee (patch)
treee12fd62f54465ed0572a7f365064b8295a221bc0
parent5304c854a423be0e718f187d47277b30cb71cbc5 (diff)
downloadxv6-labs-9b972c06b172531e5792fc0e05d83319d325e0ee.tar.gz
xv6-labs-9b972c06b172531e5792fc0e05d83319d325e0ee.tar.bz2
xv6-labs-9b972c06b172531e5792fc0e05d83319d325e0ee.zip
Update stressfs to trigger race now the logging code serializes writes
-rw-r--r--stressfs.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/stressfs.c b/stressfs.c
index 5d4fee2..6369400 100644
--- a/stressfs.c
+++ b/stressfs.c
@@ -2,8 +2,10 @@
// appends to the idequeue results in a race.
// For this to work, you should also add a spin within iderw's
-// idequeue traversal loop. Spinning 40000 times demonstrated the bug
-// after about 5 runs of stressfs in QEMU on a 2.1GHz CPU.
+// idequeue traversal loop. Adding the following demonstrated a panic
+// after about 5 runs of stressfs in QEMU on a 2.1GHz CPU:
+// for (i = 0; i < 40000; i++)
+// asm volatile("");
#include "types.h"
#include "stat.h"
@@ -16,19 +18,29 @@ main(int argc, char *argv[])
{
int fd, i;
char path[] = "stressfs0";
+ char data[512];
printf(1, "stressfs starting\n");
+ memset(data, 'a', sizeof(data));
for(i = 0; i < 4; i++)
if(fork() > 0)
break;
- printf(1, "%d\n", i);
+ printf(1, "write %d\n", i);
path[8] += i;
fd = open(path, O_CREATE | O_RDWR);
- for(i = 0; i < 100; i++)
- printf(fd, "%d\n", i);
+ for(i = 0; i < 20; i++)
+// printf(fd, "%d\n", i);
+ write(fd, data, sizeof(data));
+ close(fd);
+
+ printf(1, "read\n");
+
+ fd = open(path, O_RDONLY);
+ for (i = 0; i < 20; i++)
+ read(fd, data, sizeof(data));
close(fd);
wait();