]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r255714, r255716, r255717:
authortrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Oct 2013 18:53:13 +0000 (18:53 +0000)
committertrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Oct 2013 18:53:13 +0000 (18:53 +0000)
commit9ea77b180d99b978657d287744adfe8fd4218308
tree37a731489980ff36b198718622cc4cccccf0c84b
parentd4260a6c309c4f379ce2d0825750570d68b69a4a
MFC r255714, r255716, r255717:

r255714:

Use cv_broadcast() instead of cv_signal() when waking up threads
waiting on an empty queue as the queue may have several consumers.

Before the fix the following scenario was possible: 2 threads are
waiting on empty queue, 2 threads are inserting simultaneously. The
first inserting thread detects that the queue is empty and is going to
send the signal, but before it sends the second thread inserts
too. When the first sends the signal only one of the waiting threads
receive it while the other one may wait forever.

The scenario above is is believed to be the cause of the observed
cases, when ggate_recv_thread() was getting stuck on taking free
request, while the free queue was not empty.

Reviewed by: pjd
Tested by: Yamagi Burmeister yamagi.org

r255716:

When updating the map of dirty extents, most recently used extents are
kept dirty to reduce the number of on-disk metadata updates. The
sequence of operations is:

1) acquire the activemap lock;
2) update in-memory map;
3) if the list of keepdirty extents is changed, update on-disk metadata;
4) release the lock.

On-disk updates are not frequent in comparison with in-memory updates,
while require much more time. So situations are possible when one
thread is updating on-disk metadata and another one is waiting for the
activemap lock just to update the in-memory map.

Improve this by introducing additional, on-disk map lock: when
in-memory map is updated and it is detected that the on-disk map needs
update too, the on-disk map lock is acquired and the on-memory lock is
released before flushing the map.

Reported by: Yamagi Burmeister yamagi.org
Tested by: Yamagi Burmeister yamagi.org
Reviewed by: pjd

r255717:

Fix comments.

git-svn-id: svn://svn.freebsd.org/base/stable/8@256028 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sbin/hastd/hast.h
sbin/hastd/primary.c
sbin/hastd/secondary.c