forked from mit-pdos/xv6-public
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the test we used in lecture to creash the IDE system when the
locks were moved around.
- Loading branch information
Austin Clements
committed
Nov 23, 2009
1 parent
d6cd7d0
commit f4c12f1
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,7 @@ UPROGS=\ | |
_mkdir\ | ||
_rm\ | ||
_sh\ | ||
_stressfs\ | ||
_usertests\ | ||
_wc\ | ||
_zombie\ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Demonstrate that moving the "acquire" in iderw after the loop that | ||
// 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. | ||
|
||
#include "types.h" | ||
#include "stat.h" | ||
#include "user.h" | ||
#include "fs.h" | ||
#include "fcntl.h" | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
int i; | ||
printf(1, "stressfs starting\n"); | ||
|
||
for (i = 0; i < 4; i++) { | ||
if (fork() > 0) { | ||
break; | ||
} | ||
} | ||
|
||
printf(1, "%d\n", i); | ||
|
||
char path[] = "stressfs0"; | ||
path[8] += i; | ||
int fd = open(path, O_CREATE | O_RDWR); | ||
for (i = 0; i < 100; i++) | ||
printf(fd, "%d\n", i); | ||
close(fd); | ||
|
||
wait(); | ||
|
||
exit(); | ||
} |