diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-06-15 03:51:44 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-06-15 03:51:44 +0000 |
commit | 029226f3a85acf1d4be6aa09215d8e97ded96cb0 (patch) | |
tree | d973d36efe46a45520c40d7d6276ec68a4318a28 /sys/fs | |
parent | 586342bb6a2e371cab9eccaa57393f6aecbe3c3c (diff) | |
download | FreeBSD-src-029226f3a85acf1d4be6aa09215d8e97ded96cb0.zip FreeBSD-src-029226f3a85acf1d4be6aa09215d8e97ded96cb0.tar.gz |
Grab the socket buffer send or receive mutex when performing a
read-modify-write on the sb_state field. This commit catches only
the "easy" ones where it doesn't interact with as yet unmerged
locking.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/fifofs/fifo_vnops.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 80fe7b6..c35a8a0 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -211,7 +211,9 @@ fail1: } fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; + SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&rso->so_rcv); vp->v_fifoinfo = fip; } @@ -229,7 +231,9 @@ fail1: if (ap->a_mode & FREAD) { fip->fi_readers++; if (fip->fi_readers == 1) { + SOCKBUF_LOCK(&fip->fi_writesock->so_snd); fip->fi_writesock->so_snd.sb_state &= ~SBS_CANTSENDMORE; + SOCKBUF_UNLOCK(&fip->fi_writesock->so_snd); if (fip->fi_writers > 0) { wakeup(&fip->fi_writers); sowwakeup(fip->fi_writesock); @@ -243,7 +247,9 @@ fail1: } fip->fi_writers++; if (fip->fi_writers == 1) { + SOCKBUF_LOCK(&fip->fi_writesock->so_rcv); fip->fi_readsock->so_rcv.sb_state &= ~SBS_CANTRCVMORE; + SOCKBUF_UNLOCK(&fip->fi_writesock->so_rcv); if (fip->fi_readers > 0) { wakeup(&fip->fi_readers); sorwakeup(fip->fi_writesock); |