collie: allow calling queue_work() in done()

Currently, if we call queue_work() in the second event_loop(),
work_queue_wait() cannot wait for completion of the work.

This adds a field 'nr_workers' to the worker_info and makes
work_queue_empty() return true only if both worker_routine() and
worker_thread_request_done() have no outstanding works.  I think this
removes a race condition in work_queue_wait() completely.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
event: use specified timeiout for epoll_wait

There is no need to wait 1 second every time.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests/008: wait for sheep to finish recovery

'collie vdi write' can finish before sheep recovers all the objects,
so it is safe to wait for sheep to complete recovery.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: reboot sheepdog without collie shutdown

The current master can lose objects if we restart sheepdog without
'collie cluster shutdown' several times.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: get object list from stale directory

If we stop sheepdog when we have no replicas in the working directory,
sheep cannot recover the objects after restarting.  It is because
sheep doesn't look into the stale directory when creating a object
list.  This fixes the problem.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: get vdi bitmap from joined node

If we stop sheepdog without the shutdown command, the number of nodes
will be rapidly reduced and it will easily happen that all the
replicas are lost.  In such case, it is better to get vdi bitmap from
the newly joined node too so that we can recover so many vdis as we
can.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>