diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2012-11-17 23:08:23 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2012-11-17 23:08:23 +0000 |
commit | d61772fd2a28c4d68abf20354d6a30324357f557 (patch) | |
tree | 821e69a0d17cde66bcfa6018f8e5d8a090937825 /sys/kern/vfs_subr.c | |
parent | 49175dac6e732dd877e6aa295f301ab21e422c75 (diff) |
Don't map a buffer (and potentially sleep) when invalidating it in vinvalbuf.
This fixes a problem where we could sleep for kva and then our pointers
would not be valid on the next pass through the loop. We do this
by adding buf_acquire_nomap() - which can be used to busy up the buffer
without changing its mapped or unmapped state. We do not need to have
the buffer mapped to invalidate it, so it is sufficient to acquire it
for that. In the case where we write the buffer, we do map the buffer, and
potentially sleep.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9e1a850b931..3a6ff0773c4 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.199 2012/10/01 00:08:43 guenther Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.200 2012/11/17 23:08:22 beck Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1863,17 +1863,18 @@ loop: break; } bremfree(bp); - buf_acquire(bp); /* * XXX Since there are no node locks for NFS, I believe * there is a slight chance that a delayed write will * occur while sleeping just above, so check for it. */ if ((bp->b_flags & B_DELWRI) && (flags & V_SAVE)) { + buf_acquire(bp); splx(s); (void) VOP_BWRITE(bp); goto loop; } + buf_acquire_nomap(bp); bp->b_flags |= B_INVAL; brelse(bp); } |