ploop_check(): simplify arguments

Replace readonly, raw and verbose arguments with CHECK_* flags.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop_get_dev_by_delta: not mounted if no image

Return "not mounted" state if an image does not exists,
as it is not possible to delete a mounted image.

Reference: ploop@1053461
ploop_get_dev_by_delta: use access not stat

As we are not interested in anything stat() returns,
let's just use access() instead.

This is an addition to previous commit 561e660 (aka r1053461).

Reference: ploop@1066275
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
MINOR check_host_ext4_mount_opts: minor cleanup

* function just print warning, do not return result
* removed unused variables

Reference: ploop@1063821
check_mount_restrictions(): check for all images

Perform checking for all images that will be mounted since
they could be placed on different devices.

[kir@: extended description follows]

check_mount_restrictions() is called before ploop mount to check
that the underlying FS is sufficient (has extents) and is properly
mounted (no "bad" mount options).

Unfortunately we only do it for base delta, which is OK for default
setup, but there might be cases when deltas reside on different
mounts.

This patch adds checking of underlying FS for all images. As such
checking might be expensive we try to optimize for the common case
when all the deltas are on the same FS.

Reference: ploop@1064039
check_host_ext4_mount_opts(): return code

The initial idea was to have this function print a warning,
but later switch from a warning to an error, i.e. disable
working on ploop with "bad" mount option being set.

Unfortunately, commit f020faa (aka r1063821) reverted that functionality.
Let's put it back. Also, if there's some internal error,
don't proceed (as all the other code does).

TODO: replace a warning with an error some time later.

Reference: ploop@1066111
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Igor Sukhih <igor@parallels.com>
ploop_merge_snapshot_by_guid: fix offline merge with raw base image

Offline merge with raw base image resulted in image corruption.
The raw flag is raised incorrectly raised, which resulted in
using raw logic to merge expanded deltas. The raw flag should
be raised only if expanded delta merged with raw delta.

Reference: PSBM-28490
Reference: ploop@1044915
check_mount_restrictions(): fix an error message

Fix to commit c0da38f aka r1064039. It's stat not statfs.

Reference: ploop@1066110
Signed-off-by: Kir Kolyshkin <kir@openvz.org>