Skip to content

Commit

Permalink
fix buf where concurrent fs syscalls race on log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Cody Cutler committed Feb 19, 2015
1 parent 41f16c2 commit 3d2dedd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ log_write(struct buf *b)
if (log.outstanding < 1)
panic("log_write outside of trans");

acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
if (log.lh.sector[i] == b->sector) // log absorbtion
break;
Expand All @@ -225,5 +226,6 @@ log_write(struct buf *b)
if (i == log.lh.n)
log.lh.n++;
b->flags |= B_DIRTY; // prevent eviction
release(&log.lock);
}

0 comments on commit 3d2dedd

Please sign in to comment.