]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r255714, r255716, r255717:
authortrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Oct 2013 18:52:04 +0000 (18:52 +0000)
committertrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Oct 2013 18:52:04 +0000 (18:52 +0000)
commitcc7b4c75fd5f431e9aa1ca6e371e08fcecfd0213
tree549500384f510bd9d3ee5a0774ada145ad82622a
parentd5e86b62a229b3bf4f38c4c0d1a9ca1eef47f3c5
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/9@256027 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sbin/hastd/hast.h
sbin/hastd/primary.c
sbin/hastd/secondary.c