Skip to content
Snippets Groups Projects
stressfs.c 747 B
Newer Older
// 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[])
{
Russ Cox's avatar
Russ Cox committed
  int fd, i;
  char path[] = "stressfs0";

Russ Cox's avatar
Russ Cox committed
  for(i = 0; i < 4; i++)
    if(fork() > 0)
Russ Cox's avatar
Russ Cox committed
  fd = open(path, O_CREATE | O_RDWR);
Austin Clements's avatar
Austin Clements committed
  for(i = 0; i < 100; i++)