logger: detect death of its parent process in a correct manner

init process doesn't always be a parent of logger process even sheep
process dies. It depends on execution environment. This patch
implements a correct way of detecting death of sheep process in logger
process.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: let add_vdi_state() be a thread safe

add_vdi_state() can be called by worker threads. So ec_max_data_strip
should be protected by a mutex.

Tested-by: Valerio Pachera <sirio81@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: compare oid directly

Comparing hash values of oids for purposes like sorting and searching
is completely unreasonable. This patch lets obj_cmp() compare oids
directly.

Tested-by: Valerio Pachera <sirio81@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: rollback vnode info which is younger than last gathered epoch for ec

sheep needs to rollback vnode info history beyond last gathered epoch
for erasure coding. Because erasure coded VDIs require recovery from
stale directory when a number of nodes is smaller than a number of
data stripes.

Related bug:
https://bugs.launchpad.net/sheepdog-project/+bug/1367612

Reported-by: Valerio Pachera <sirio81@gmail.com>
Tested-by: Valerio Pachera <sirio81@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
tests/functional: a new test for erasure coding recovery

This new test case checks recovery process for a case of nr nodes < nr
data stripes.

Tested-by: Valerio Pachera <sirio81@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: exit when vdi bitmap collection is failed

In our test environment, we found an inconsistency of vdi bitmap
caused by failed colleciton process. The inconsistency is really
critical so calling panic() is much safer.

Reviewed-by: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
initial systemd support

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
update CHANGELOG.md for v0.9.0

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Update version for sheepdog v0.9.0_rc1

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
lib: add an interface for registering workqueue for libsheepdog

purge_directory() of libsheepdog can call bunch of unlink(2), so it
can cause long request blocking because sheep process calls the
function in its main thread. For avoiding such a problem, this patch
add a new interface for registering workqueue used in util.c of
libsheepdog and let sheep use it.

Cc: Philip Crotwell <crotwell@seis.sc.edu>
Cc: Masahiro Tsuji <tuji@atworks.co.jp>
Tested-by: Masahiro Tsuji <tuji@atworks.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
lib: call rmdir(2) and unlink(2) in worker threads during purging directory

purge_directory() can cause amount of disk I/O because of rmdir(2)
and unlink(2). Because they can slow down main thread significantly,
it should be done in worker threads for avoiding long request
blocking.

Cc: Philip Crotwell <crotwell@seis.sc.edu>
Cc: Masahiro Tsuji <tuji@atworks.co.jp>
Tested-by: Masahiro Tsuji <tuji@atworks.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Update version for sheepdog v0.9.0_rc2

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: handle a case of duplicated create and write requests for iSCSI multipath

In a case of iSCSI multipath, there is a possibility of duplicated
create and write requests from different tgtd. In this case, existing
objects can be overwritten by the duplicated requests. This patch
removes this overwite problem by let sheep check existence of newly
created object.

Cc: YAMADA Hideki <yamada.hideki@lab.ntt.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>