recovery: reorder recover_object_from_replica()

Move valloc() after store->link() operation will save us one glibc call for
recovering local objects.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: don't exit at EIO

We don't work with local driver yet because it doesn't handle LEAVE correctly,
but I have tested with corosync, it works:

the failed node can act as a gateway node seamlessly.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
plain: fix prealloc() errno

This will fix the spurious failure of tests/042.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: add test to check disk error

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
cluster/local: handle leave events

A cluster driver needs to call event handlers even after leave_cluster
is called.  This patch fixes it.

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

This is necessary to call free safely when the target object is in the
local node.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests/010: fix spurious failure on small disks

Let all sheep start with the same disk size.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: avoid atomic operations against uint64_t/int64_t variables

On 32 bit architectures, atomic operations against 64 bit integers are
not allowed.  This patch uses more proper types for them.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: fix printf format errors on 32 bit machines

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

This fixes a valgrind error on debian wheezy i686.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: append log outputs instead of overwriting

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: filter repeated lines to avoid double umount call

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

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: add a test to test vdi snapshot functionality concurrently

This patch will fail against current master branch because of object cache
regression, which is expected to be fixed by later patch.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
introduce SD_FLAG_CMD_DIRECT to bypass object cache

Currently, collie commands also use object cache if it is enabled.
This causes problems because sheep doesn't assume that other nodes
also creates cache data of the same opened VDIs.  If we allow it, data
inconsistency problems happen when another node updates the cached
objects.

This patch forces collie commands to bypass object cache to avoid the
problem, but vdi read and write still use object cache because they
are used to emulate VM I/Os.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: add test to check partial read and write

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep/plain: set offset correctly in create_and_write

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

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: fix object cache size setting

Use megabytes as unit and allow users to spefify size ranging from 1 ~ 4294967295
megabytes for object cache.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Merge remote-tracking branch 'official/master'