OpenVZ-legacy
  1. OpenVZ-legacy

ploop.ovzl

Public
AuthorCommitMessageCommit dateIssues
Kir KolyshkinKir Kolyshkin
852023ce048Released ploop 1.12.2Changelog: see https://openvz.org/Download/ploop/1.12.2/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
ba0ddd0c930ploop_trim(): rm double range.len initAs since commit r1096253 (aka d7e1a04) we initialize range.len before each iteration, it doesn't make sense to do it during declaration. So, simplify the code to just initialize the structure with zeroes. This is an addition to commit r1096253 (aka d7e1a04). Signed-off-by: Kir Kolyshkin <kir@openvz.org> (cherry picked from commit 93dcf0c24dd96a18438897ae47d3392cfa3cc68b)
Igor SukhihKir KolyshkinIgor Sukhih
59f2453a614ploop_trim(): fix len argumentThis is a fix to the following error from vzctl compact (or ploop balloon discard): Can't trim file system: Invalid argument This happens on new kernels (since 042stab10x), that inherited a patch from RHEL6: 2.6.32-487.el6 [fs] ext4: Avoid underflow in ext4_trim_fs() (Lukas Czerner)[998785] That RHEL6 patch adds a check for range.len and returns an error if it is incorrect. On old kernels...PSBM-30973
Kir KolyshkinKir Kolyshkin
bebf1f1d9fecheck_host_ext4_mount_opts(): return codeThe 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 la...
Igor SukhihKir KolyshkinIgor Sukhih
3d79718f8bccheck_mount_restrictions(): check for all imagesPerform 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 migh...
Igor SukhihKir KolyshkinIgor Sukhih
3f2cc00c3e0MINOR check_host_ext4_mount_opts: minor cleanup* function just print warning, do not return result * removed unused variables Reference: ploop@1063821 (cherry picked from commit f020faaa9b1e62491134dd85309a13a49d177a8d)
Igor SukhihKir KolyshkinIgor Sukhih
15f6e3b7a6bploop_merge_snapshot_by_guid: fix offline merge with raw base imageOffline 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 (cherry picked from commit aa56b72c615c22dd0797e4f7544d413533ad38f3)PSBM-28490
Kir KolyshkinKir Kolyshkin
9bbdf01307freread_part(): compilation fixThis is a fix to previous commit ba05b2a. Reported-by: travis-ci Signed-off-by: Kir Kolyshkin <kir@openvz.org> (cherry picked from commit eec482a3792b034454e0f595cca7fa44ecdfa326)
Kir KolyshkinKir Kolyshkin
ac2ef1fcc5ereread_part(): repeat ioctl if EBUSYAs reported in https://bugzilla.openvz.org/3081 and at http://forum.openvz.org/index.php?t=msg&goto=51702, sometimes BLKRRPART ioctl (which we call during ploop creation) returns EBUSY, so the whole 'vzctl create' thing fails. Let's not fail but retry. https://bugzilla.openvz.org/3081 Reported-by: poiuty <poiuty@lepus.su> Acked-by: Igor Sukhih <igor@parallels.com> Acked-by: Maxim Patlasov <m...
Kir KolyshkinKir Kolyshkin
37dd7762510check_deltas(): read-only check for non-top deltasThis partially reverts commit f5e4719. Opening non-top deltas in rw mode can actually be dangerous and is not really expected by user, as those deltas are supposed to be used in read-only mode and therefore should stay intact. Signed-off-by: Kir Kolyshkin <kir@openvz.org> (cherry picked from commit 1934b21c8faac0491939bdeb77e32554e1faf6a2)
Kir KolyshkinKir Kolyshkin
3f7b6886bd2ploop check dd.xml: skip check if ploop is usedCheck should not be done if this set of images is in use by some ploop device. So, add a call to ploop_get_devs() and return an error if it finds that the device is in use. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Acked-by: Maxim Patlasov <mpatlasov@parallels.com> (cherry picked from commit a4de0b6405e8c14319758c0f0ad42ff520ad7205)
Kir KolyshkinKir Kolyshkin
b264644803eploop check dd.xml: lock ddOperation "ploop check DiskDescriptor.xml" should lock ddxml for a duration of the check, otherwise races are possible, resulting in broken top delta, such as one with incorrect size, broken GPT etc. One such case is shown in OpenVZ bug #3074. As dd.xml locking is internal to the library, add a function check_dd() that does the locking, and use it from the ploop tool. There's probably no need...PSBM-28961
Kir KolyshkinKir Kolyshkin
110d209ee67Released ploop 1.12.1Changelog: see https://openvz.org/Download/ploop/1.12.1/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
0d8bf29313eploop_copy_send: wait for send_thread to finishThis should fix a race condition between the main process and send_thread. The problem is that the main process doesn't wait for send_thread to finish its work, incorrectly assuming that if it can take the mutex lock again, the send_thread has already finished. But there might be a situation when send_thread() still waits in pthread_cond_wait() (with the mutex lock released), while async_send ...
Kir KolyshkinKir Kolyshkin
1ff79b26941ploop_copy_send: use while in pthread_cond_waitIt's a common practice and a good thing to recheck the condition after being woken up. Reported-by: Maxim Patlasov <mpatlasov@parallels.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
e32afb06d54ploop mount: add check for host mount optsAs pointed out in bug #3030, ext4 fs that hosts ploop images should not be mounted with data=writeback as it increases chances of broken ploop. This patch adds a check for such mount option -- if it is found then a warning message is printed once, suggesting to not use it. https://bugzilla.openvz.org/3030 Reported-by: Devon <devon.b@virtualcomplete.com> Signed-off-by: Kir Kolyshkin <kir@open...
Kir KolyshkinKir Kolyshkin
a077fe7bc49send_thread(): move mutex lock/unlock out of do/whileAs suggested by Maxim, there is no point to release a mutex and immediately take it again. Reported-by: Maxim Patlasov <mpatlasov@parallels.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
27b48271bb8async_send(): call pthread_cond_signal() with mutex lockedFrom pthread_conf_signal man page: > The pthread_cond_broadcast() or pthread_cond_signal() functions may be > called by a thread whether or not it currently owns the mutex that > threads calling pthread_cond_wait() or pthread_cond_timedwait() have > associated with the condition variable during their waits; however, if > predictable scheduling behavior is required, then that mutex s...
Kir KolyshkinKir Kolyshkin
8279bdaf0ecploop_is_large_disk_supported(): check ploop module firstA user got the following error: > # ploop snapshot-switch -u cc0930cb-0e5e-46d8-9f4d-83567ce8fb38 DiskDescriptor.xml > Opening delta /vz/private/120/root.hdd/root.hdd > del snapshot {5fbaabe3-6958-40ff-92a7-860e329aab41} > Adding snapshot {5fbaabe3-6958-40ff-92a7-860e329aab41} > Storing /vz/private/120/root.hdd/DiskDescriptor.xml.tmp > Error in do_create_delta (ploop.c:345): Unknown ploop imag...
Kir KolyshkinKir Kolyshkin
32e630837e8ploop_switch_snapshot_ex(): don't show error on ENOENT rmA failure to remove old top delta is not fatal, plus if ENOENT is returned it doesn't make sense to even show the error. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
7e0365c0f8ftune_fs(): fix check for non-implemented ioctlThe check was obviously broken -- errno values are positive. This is a fix to commit 5a0ab39. Reference: ploop@1044468 Reported-by: Corrado Fiore <lists@corradofiore.it> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
33c7e878d5bReleased ploop 1.12Changelog: see https://openvz.org/Download/ploop/1.12/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b68f919cacbploop info help: add -dThis is an addition to commit 0b51f0d. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
276dfc7aa4eploop_check(): use reopen_rw()1. reopen_rw(): check the result of close(), reassign new fd 2. modify check_and_repair_sparse to use *fd not fd 3. use reopen_rw() in ploop_check() Reference: ploop@1037067
Igor SukhihKir KolyshkinIgor Sukhih
9c528410b89[style] check.c: rearrange code to remove function declarationmove up: static int reopen_rw(const char *image, int *fd); static int fill_hole(const char *image, int *fd, off_t start, off_t end, int *log, int repair); static int check_and_repair_sparse(const char *image, int fd, __u64 cluster, int flags); Reference: ploop@1037054
Igor SukhihKir KolyshkinIgor Sukhih
f9eb8195141ploop_check: fixed reopen fd logicThis is a fix to commit 1bfbe42. Reference: ploop@1037051
Kir KolyshkinKir Kolyshkin
058480ef46amake_fs(): add tunefs -e remount-roAs suggested in bug #3025, it is good to remount ploop inner filesystem read-only as soon as kernel sees it is corrupted, in order to prevent any more damage. https://bugzilla.openvz.org/3025 Reported-by: Pavel Odintsov <pavel.odintsov@gmail.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
1bfbe4236bbploop_check(): don't pass -1 to closeThis fixes a complain from Coverity Scan: > CID 1228664 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS) > negative_returns: fd is passed to a parameter that cannot be negative. While at it, use close_safe() to close the old fd, so we can detect and report an error. Reference: ploop@1036954 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
e548c2d2e09check_and_repair_sparse(): reopen image rw if neededAfter the commit r1036784, we can be in the situation when image is opened as read-only but check_and_repair_sparse() needs to write to it. As we don't know beforehand whether we will need to write to an image file or not, let's fix it in a somewhat kludgy way -- as soon as we found out we need to write, check opened fd mode and reopen the image read/write if necessary. Note this is only perfo...2 Jira Issues
Kir KolyshkinKir Kolyshkin
b3aae6bc170fill_hole: use *fdReplace fd argument with pointer to it. This is a preparation for the next commit, to make it easier to read. Reference: ploop@1036951 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
7ea107768d6check_and_repair_sparse: use fill_hole ret codeSince fill_hole returns SYSEXIT_* values it makes sense to return those explicitly. Reference: ploop@1036950 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
164d098eab6fill_hole(): no need to bzero static bufIn C, statically-allocated objects without an explicit initializer are initialized to zero, so there is no need for explicit bzero(). While at it, mark buf as const to make sure it is kept as is (all zeroes). Reference: ploop@1036949 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
d5cbe9ae829ploop_check(): open image RO, reopen RW laterMost of the time writing to the image file is not required, so let's optimize for this case and open the file read only. Later, if an image has dirty flag set, of CHECK_DETAILED is set, reopen the file in read/write mode. This also helps with filesystems on which opening the file read/write is more expensive than opening it read-only. Reference: PSBM-26499 References: ploop@1036784, ploop@103...PSBM-26499
Kir KolyshkinKir Kolyshkin
a25968cf30fploop_create_{image,dd}: use ploop_di_add_image ret valueAs ploop_di_add_image is always returning proper SYSEXIT_* code, let's just use it directly, saving a couple lines of code. This also fixes a few cases of returning SYSEXIT_MALLOC instead of SYSEXIT_PARAM which ploop_di_add_image() returns sometimes. Reference: ploop@1031842 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
0da809ed5a3Added ploop_create_dd()Added functionality to create DiskDescriptor.xml at custom path int ploop_create_dd(const char *ddxml, struct ploop_create_param *param) Reference: PSBM-26581 References: ploop@1031445, ploop@1031841 Signed-off-by: Kir Kolyshkin <kir@openvz.org>PSBM-26581
Igor SukhihKir KolyshkinIgor Sukhih
8e5b3a75cc1fsutils.c: quiet fsckfsck output can broke tools parser. There is no quiet option for fsck so just redirect stdout to /dev/null # fsck -p /dev/ploop26995p1 fsck from util-linux-ng 2.17.2 /dev/ploop26995p1: clean, 12/655360 files, 83119/2620928 blocks [kir@: errors from fsck will still be shown on stderr] Reference: PSBM-26738 Reference: ploop@1008262PSBM-26738
Kir KolyshkinKir Kolyshkin
a093baa5839ploop_get_max_size: improve description, move to cWe do not have descriptions of our public functions in libploop.h file, so let's not start doing it. So far, the best documentation for such functions is their code itself, so let's keep the description close to the code. This is an addition to the previous commit 71be8d5 Cc: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Nikolay ShirokovskiyKir KolyshkinNikolay Shirokovskiy
b46eecff3e6ploop_get_max_size(): add[kir@: add dynload.h entry] Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Acked-by: Igor Sukhih <igor@parallels.com> Reference: PSBM-26570 - ""ploop convert" fails to convert the container due to huge limit for "diskinodes"" Reference: ploop@1028131 Signed-off-by: Kir Kolyshkin <kir@openvz.org>PSBM-26570
Kir KolyshkinKir Kolyshkin
5d606213507De-introduce SYSEXIT_INUSEThis was introduced by the previous commit 22ff44b (aka ploop@1025736) for the sole purpose of reporting the "in-use flag is set" condition from get_image_param_offline(), which, in turn, takes it from errno value explicitly set to EBUSY by open_delta(). This condition is then checked in the only place -- do_create_snapshot(). Note that SYSEXIT_* codes are part of public API, but this new valu...
Igor SukhihKir KolyshkinIgor Sukhih
ebb6e5213b3create_snapshot: clear stale top delta inuse flagSometimes after the node crash the top delta in-use flag is left set, so snapshot creation returns an error. Handle this particular case by calling check_delta to validate top delta and drop inuse flag on create snapshot. Reference: PSBM-27694 "Failed to create the snapshot: Operation failed. %1 after node crash" References: ploop@1025736, ploop@1026188 Signed-off-by: Kir Kolyshkin <kir@openv...PSBM-27694
Kir KolyshkinKir Kolyshkin
c9439349f67ploop(8): document ploop info -dThis is an addition to commit 0b51f0d Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Nikolay ShirokovskiyKir KolyshkinNikolay Shirokovskiy
0b51f0d7d85ploop info: add -d to show ploop deviceReference: PSBM-26990 Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Acked-by: Igor Sukhih <igor@parallels.com> References: ploop@1025015, ploop@1026043PSBM-26990
Kir KolyshkinKir Kolyshkin
9d151b06195tune_fs: fix error message, assorted nitpicksA few nitpicks after commit 5a0ab39 (ploop@1022894), in the order of importance; 1. Fix an error message (s/for size/to/, obviously a copy-paste error) 2. Pass errno to ploop_err() to know why ioctl failed 3. An empty line between variable declarations and code 4. Some more empty lines to improve code readability. 5. A comma in a comment. Reference: ploop@1025878 Signed-off-by: Kir Kolysh...
Dmitriy MonakhovKir KolyshkinDmitriy Monakhov
5a0ab39da92tune_fs(): use EXT4_IOC_SET_RSV_BLOCKS if availableWe have to update reservation block counts according to balloon size. One can do that directly via tune2fs which is not good for mounted fs, and should use this ioctl instead EXT4_IOC_SET_RSV_BLOCKS is available since 042stab092.1. In case it's not there, fall back to old implementation. Signed-off-by: dmonakhov@openvz.org Committed-by: igor@openvz.org Reference: PSBM-25929 "Error in __ploop_...PSBM-25929
Igor SukhihKir KolyshkinIgor Sukhih
71c50ce3835ploop_delete_snapshot: fix for temp snapshotIn case snapshot guid supplied is one of temp snapshot, we first implicitly delete it in merge_temporary_snapshots(), then try to delete it again explicitly in do_delete_snapshot() and we fail. To fix, move merge_temporary_snapshots() to after do_delete_snapshot. Reference: PSBM-27327 "Error in do_delete_snapshot (snapshot.c:61): Can't find snapshot by uuid" Reference: ploop@1021028, ploop@10...PSBM-27327
Kir KolyshkinKir Kolyshkin
01e7bd62da5reset_top_delta(): rm irrelevant messageApparently a copy-paste leftover. This is an addition to commit 86f3119 (ploop@1019626) Reference: ploop@1020175 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
86f31196486ploop_switch_snapshot_ex: fixed case with PLOOP_SNAP_SKIP_TOPDELTA_CREATEThe PLOOP_SNAP_SKIP_TOPDELTA_CREATE used in rollback, move logic to separate function Reference: ploop@1019626
Igor SukhihKir KolyshkinIgor Sukhih
9f7a9f831bemerge_temporary_snapshots: fix infinite loopIn case a snapshot with references deleted, there's an infinite loop. Reference: ploop@1019621
Kir KolyshkinKir Kolyshkin
89b657c221ado_delete_snapshot(): fix a warningFix and improve a warning message about inability to remove a snapshot with >1 references to it, and marking it as temp. This is an addition to commit ploop@1016663 aka 32711a4. Reference: ploop@1016859 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
eeb46fe42c9do_delete_snapshot: deny delete top delta in case parent snapshot is temporaryCreating temporary snapshot and deleting top delta broke DiskDescriptor.xml: ploop tsnapshot -u {aff55492-7320-4d72-aedd-c1e303a22cc1} -c test DiskDescriptor.xml ploop snapshot-delete -u {5fbaabe3-6958-40ff-92a7-860e329aab41} DiskDescriptor.xml ploop mount DiskDescriptor.xml Error in validate_disk_descriptor (xml.c:327): Validation of /vz/igor/Virtuozzo/current/ploop/DiskDescriptor.xml f...