1 // Demonstrate that moving the "acquire" in iderw after the loop that
2 // appends to the idequeue results in a race.
4 // For this to work, you should also add a spin within iderw's
5 // idequeue traversal loop. Spinning 40000 times demonstrated the bug
6 // after about 5 runs of stressfs in QEMU on a 2.1GHz CPU.
15 main(int argc
, char *argv
[])
18 char path
[] = "stressfs0";
20 printf(1, "stressfs starting\n");
22 for(i
= 0; i
< 4; i
++)
29 fd
= open(path
, O_CREATE
| O_RDWR
);
30 for(i
= 0; i
< 100; i
++)
31 printf(fd
, "%d\n", i
);