corosync: fix a compiler warning

Fix following warning:

...
cluster/corosync.c: In function ‘corosync_get_local_addr’:
cluster/corosync.c:132:22: warning: declaration of ‘sin’ shadows a global declaration [-Wshadow]
  CCLD   sheep
make[1]: Leaving directory `/home/test/sheepdog/sheep'
...

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
init trace for work queue before journal init

when journal thread init before the initialization of trace,
it enter into loop (using uninitailized `tid_max`)with
--debug-enable configured. we need to initialize trace before
 journal thread init.
this patch extrace `wq_trace_init` from `init_work_queue` and
call it in the main() function just before the initialization
of journal file.

[Hitoshi: removed inline modifier from declaration of wq_trace_init()
in lib/work.c]

Signed-off-by: Jinzhi Chen <nxtjinzhi@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
init trace for work queue in dog command

when extrace `wq_trace_init` from `init_work_queue`,
we need to call `wq_trace_init` before `init_work_queue`
so that dog's new thread can work properly.

Signed-off-by: Jinzhi Chen <nxtjinzhi@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: use correct number of copies during reference decrement

In a case of nr_zones < nr_copies of deleted VDI, current sheep panics
because it cannot obtain correct list of nodes which hold target
ledgers. This patch solves the problem.

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>
sheep/http: check correct variable

We should check the return pointer of strstr().

[Hitoshi: improve commit log a little bit]

Signed-off-by: Bingpeng Zhu <bingpeng.zbp@alibaba-inc.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
dog: referencing uninitialized buffer during cluster format

when executing dog cluster format,
by referring to the memory area that is not initialized
update_node_list() was an unintended behavior.

Signed-off-by: Masaki Saeki <saeki.masaki@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep/ops.c: fix problem caused by uninitialized backend storage in gateway

when a new gateway(never joined a cluster before) joined a existing
clsuter. `dog vdi object location` causes the new gateway exist
because its backend storage is not initialized.
this patch solves this problems by checking whether a node is gateway
in `local_oid_exist` fucntion. simple return `SD_RES_NO_OBJ` to avoid
using uninitialized pointer.

Signed-off-by: Jinzhi Chen <nxtjinzhi@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>