Frank Filz has uploaded this change for review.

View Change

fsal_fd fd_work/io_work needs separate condition variables

This is to prevent never waking up a thread wanting to do fd work when
racing with at least two threads that want to do io work. If the 2nd
io work thread backs off to let fd work commence, and it signals the
single condition variable, the thread waiting to do fd work might or
might not wake up. We COULD just broadcast to the condition variable
but then we spurious wake up ALL the io work threads.

By separating out a separate condition variable, now we can signal
just the thread waiting to do fd work (there could be multiple, but
all we need to do is wake one of them up).

When fd work is complete, we signal the work condition variable to
wake up any waiting fd work thread. We don't care if we don't wake
them all up. Then we broadcast the io condition variable to wake
up all the io threads.

We can't check fd_work count because it's incremented outside the
mutex so we could miss fd work threads that needed to be woken up.

Change-Id: I868f223f21748eea86d446733f8709d1e53f5993
Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
---
M src/FSAL/commonlib.c
M src/include/fsal_types.h
2 files changed, 16 insertions(+), 6 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/88/1188188/1

To view, visit change 1188188. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I868f223f21748eea86d446733f8709d1e53f5993
Gerrit-Change-Number: 1188188
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Filz <ffilzlnx@mindspring.com>