OpenVZ-legacy
  1. OpenVZ-legacy

ploop.ovzl

Public
AuthorCommitMessageCommit dateIssues
Kir KolyshkinKir Kolyshkin
16f53ca9be3Released ploop 1.14Changes: see https://openvz.org/Download/ploop/1.14/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
97d01b1f15bploop snapshot-merge: add -UAlso, add it to "ploop snapshot-merge" usage and document in ploop(8). Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
0e70c490857do_ioctl(): run lsof on EBUSYSometimes despite all the retries ioctl() on ploop device still returns EBUSY, like this: > Error in ploop_stop (ploop.c:1011): PLOOP_IOC_STOP: Device or resource busy In such a case, let's provide lsof /dev/ploopXXX output to the user so they might have an idea of who's using the device. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
0ee009adf66lib/Makefile: fix ploop.pc generationThere was a typo, leading to garbage in Version: field. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
fbbcd353d5edo_ioctl(): change delaysThis is an addition to the previous commit. Let's start with a delay of 0.01s, increase 2x until up to 0.5s. Total wait time is still the same -- 60s. Also, provide a comment telling why we need to do this. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
fb5b81d6f90do_ioctl(): implement exponential wait for retryCommit cc4a397 was way too optimistic -- sometimes IOC_STOP_DEVICE returns EBUSY for more than 2 seconds, so we need to increase it back to 60 seconds. Maxim Patlasov suggested to increase sleep intervals in an exponential fashion. With this patch, sleep intervals between retries are doubled each time. It starts with 0.015s and then increases to max of 15s per interval. Here's a simulation: s...
Kir KolyshkinKir Kolyshkin
16e1b070f24read_diskdescriptor(): removeNo one is using it, probably a leftover after conversion to new reading/locking API. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
505c75682a7ploop init: fix processing --nolazy optionThis is a fix to commit 39889a0. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
3659158ed31ploop_umount_image(): simplify unlock on returnThis is just a minor refactoring, instead of calling ploop_unlock_dd() from multiple places, do "goto out" that does it for us. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
39889a01e42ploop init: add --nolazyAdd -n, --nolazy option to ploop init command, and document it in ploop(8) man page. This is a followup to commit 90ff5a7. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
cc4a3979236do_ioctl(): don't hang for a minuteInstead of doing 60 retries with 1 second interval, let's do 10 retries with 0.2 seconds interval so the function will return in no longer than 2 seconds. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
8cde46dc5e0ploop_get_top_delta_fname(): use ploop_lock(), return SYSEXIT_*A problem with ploop_get_top_delta_fname() is it can only be used when a DiskDescriptor.xml is read into memory. For example, the following code won't work: struct ploop_disk_images_data *di; char name[PATH_MAX]; ret = ploop_open_dd(&di, argv[0]); if (ret) return ret; ret = ploop_get_top_delta_fname(di, name, sizeof(name)); if (ret) return ret; printf("top delta: %s", name); Ther...
Kir KolyshkinKir Kolyshkin
90ff5a7df3eploop_create_param: add NOLAZY flagAdd flags field to struct ploop_create_param. Define PLOOP_CREATE_NOLAZY flag. If set, ext4 lazy inode table initialization feature is disabled from mkfs. From mke2fs(8) man page: lazy_itable_init[= <0 to disable, 1 to enable>] If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up filesystem initialization noticeably, b...
Kir KolyshkinKir Kolyshkin
ebc633b6f05make_fs(): don't hardcode argv indexUsing argv[i++] will help with future edits of this code. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
36c5067ad5etools/Makefile: fix LDLIBSThe only library needed to directly link tools to is ploop. This is to avoid overlinking: https://wiki.openmandriva.org/en/Overlinking_issues_in_packaging Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
627d06c8b6eMakefiles: move -lpthread to the proper placeLDFLAGS should not be populated with libs, as otherwise the order of options in ld command line will be wrong. Also, we don't need to build tools with -lpthread. Fix both issues by moving -lpthread to LDLIBS in lib/
Kir KolyshkinKir Kolyshkin
733965ca8caAdd pkgconfig fileThis makes it possible to use pkg-config when building stuff that requires ploop library. For example: # pkg-config --libs --static ploop -lploop -lrt -lpthread -lxml2 -lz -llzma -lm Note it shows libs that are not explicitly listed, but are needed to statically link with libxml2 (they are of course taken from libxml-2.0.pc). Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
427881d3f85ploop.spec: no %attr for symlinkRPM from Fedora 22 rightfully complains that %attr should not be used with symlinks. Fix by removing the %attr, as it is redundant anyway. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
7c4110fae3dploop.spec: fix date in %changelogRPM from Fedora 22 rightfully complains the date is bogus. Indeed it was Tuesday not Thursday. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
a579381e919ploop_create_image(): do not return -1Found another case when ploop library returns -1 instead of proper SYSEXIT_* code. Fix is easy. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
6767e9a17d4is_xml_fname(): fix a potential SIGSEGVIn case argument is NULL, it's definitely not an XML file so return 0 instead of crashing: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff757ac5a in __strrchr_sse2 () from /lib64/libc.so.6 Currently it appears to be no calls to is_xml_fname(NULL) but there was one -- see previous commit for details. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
ed35c6bc525ploop snapshot-switch: fix SIGSEGV parsing cmdlineThe check for arguments validity is obviously incorrect, leading to calling is_xml_fname() with NULL argument, leading to SIGSEGV: # ploop snapshot-switch Segmentation fault Another bug is, in case there is a proper number of arguments function is_xml_fname() is not called at all. Interestingly, the bug is here from the very beginning, introduced by commit r733091 (Fri Feb 3 10:51:26 2012)...
Kir KolyshkinKir Kolyshkin
ebf1dc3072einclude/libploop.h: doc mount and snapshot switch paramsDocument the fields and flags of * struct ploop_mount_param * struct ploop_snapshot_switch_param Also, move defines for ploop_snapshot_switch_param.flags from the very beginning of the file closer to struct ploop_snapshot_switch_param. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
38eb8a03956print_sys_block_ploop(): more compact outputSimplify the /sys/block/ploop printing, also making the output more compact (and, I hope, more readable as well). This is the way it was: ==> /sys/block/ploop14553/pdelta/0/image <== /vz/private/206/root.hdd/root.hdd ==> /sys/block/ploop14553/pdelta/0/io <== direct ==> /sys/block/ploop14553/pdelta/0/ro <== 0 This is how it is now, after this patch: /sys/block/ploop14553/pdelta/0/imag...
Kir KolyshkinKir Kolyshkin
e08904418faploop_replace_image: use mkstemp() not mktemp()This is more secure, and in Fedora 22 linker prints an annoying warning about using mktemp(): libploop.a(ploop.o): In function `ploop_replace_image': warning: the use of `mktemp' is dangerous, better use `mkstemp' Not tested much. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
0e8af37dbd7mount.ploop: check if mtab is not symlinkApparently, test -f $FILE returns true even if $FILE is a symlink. That, combined with the fact that when /etc/mtab is a symlink to /proc/mounts, gives us the following error: # mount DiskDescriptor.xml mnt -t ploop ... /sbin/mount.ploop: line 201: echo: write error: Invalid argument To fix, add a check that /etc/mtab is not a symlink Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Dmitry GuryanovKir KolyshkinDmitry Guryanov
63b75f1a6e6fix restore-descriptor for raw imagessize in ploop_create_param must be in sectors, not in bytes.
Kir KolyshkinKir Kolyshkin
efc4cc2b2f8Fix POWER compilation wrt __u64 printf/scanfOn POWER, __u64 is defined in the Linux kernel headers as "long unsinged", while on x86_64 it is defined as "long long unsigned". As a result, we have no way to uniformly printf/scanf __u64 values without type casting. The closest userspace type equivalent of __u64 is uint64_t (as defined by ISO C99: 7.18 Integer types <stdint.h>), and this is what we should cast it to. Unfortunately, uint64_t...
Kir KolyshkinKir Kolyshkin
3ceb140faf9ploop_set_max_delta_size(): fix definitionOn POWER, __u64 is defined as "unsigned long", while on x86_64 it is "unsigned long long", thus the following error: > ploop.c:3431:5: error: conflicting types for ‘ploop_set_max_delta_size’ > int ploop_set_max_delta_size(struct ploop_disk_images_data *di, __u64 size) > ^ > In file included from ploop.h:13:0, > from ploop.c:39: > ../include/libploop.h:260:5: note: previo...
Kir KolyshkinKir Kolyshkin
bbd968b1f1aget_max_ploop_size(): change type of last argUse "unsigned long long" as a portable type, to fix the following compilation error on POWER (caused by the fact that __u64 is defined as "unsigned long" on POWER, but "unsigned long long" on x86_64). > ploop.c: In function ‘ploop_get_max_size’: > ploop.c:305:2: error: passing argument 3 of ‘get_max_ploop_size’ from incompatible pointer type [-Werror] > if (get_max_ploop_size(default_fmt_ver...