summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Cutler <[email protected]>2015-02-19 11:51:47 -0500
committerCody Cutler <[email protected]>2015-02-19 11:51:47 -0500
commit3d2dedd42714fc4eb7844b17b62669e287f27583 (patch)
tree34e11f5880ea7e23575dae8cf2bab7109a3e2391
parent41f16c21832f120bba96fe1d4ba0079aaf34c11a (diff)
downloadxv6-labs-3d2dedd42714fc4eb7844b17b62669e287f27583.tar.gz
xv6-labs-3d2dedd42714fc4eb7844b17b62669e287f27583.tar.bz2
xv6-labs-3d2dedd42714fc4eb7844b17b62669e287f27583.zip
fix buf where concurrent fs syscalls race on log entries
-rw-r--r--log.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/log.c b/log.c
index b66074c..f519a8c 100644
--- a/log.c
+++ b/log.c
@@ -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;
@@ -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);
}