OpenVZ-legacy
  1. OpenVZ-legacy

ploop.ovzl

Public
AuthorCommitMessageCommit dateIssues
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...
Igor SukhihKir KolyshkinIgor Sukhih
32711a466daBUGFIX Can not delete snapshot with multiple refsThe direct way to delete snapshot with > 1 references is to make a copy of a snapshot image and merge with the copy * Delete A A -> B => A -> B => B \-> C A -> C A -> C Let's handle in another way, mark as temporary and merge when it will be possible Reference: PSBM-27154 "Can not delete snapshot of Container - double referenced" Reference: ploop@1016663PSBM-27154
Kir KolyshkinKir Kolyshkin
d77b58792cfploop_switch_snapshot_ex(): don't return 0 if guid_old is badCode checks that param->guid_old is (1) valid and (2) non-existent, and prints and error if any of those checks fails, but returns 0 instead of an error. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
31fc986e249do_delete_snapshot: fix wrt temp snapshot uuidTemporary snapshot uuid is changed if topdelta is deleted. Call check_snapshot_mount() to validate snapshot-delete action Use case: ploop tsnapshot ploop snapshot-delete <TOP_DELTA_UUID> Reference: ploop@1015313
Kir KolyshkinKir Kolyshkin
17a8a4181dcploop_resize_image(): handle get_mount_dir() errorget_mount_dir() return value is not boolean, but rather a 3-state. It doesn't make sense to proceed if it returned an error, as it's probably fatal. While at it, document get_mount_dir() return values. Signed-off-by: Kir Kolyshkin <kir@openvz.org> git-svn-id: https://svn.parallels.com/parallels/vzlin/utils/current/ploop@1015021 3f79cd19-dd19-0410-83c5-8b167e6f9dce Signed-off-by: Kir Kolyshki...
Igor SukhihKir KolyshkinIgor Sukhih
a60cc48a742ploop_resize_image: auto-mount fsProblem: unable to resize ploop if it is running but fs is not mounted Solution: automount file system before performing online resize Reference: PSBM-26764 Reference: ploop@1013361PSBM-26764
Kir KolyshkinKir Kolyshkin
d83a0ff52c4ploop_store_diskdescriptor(): fix error msgAfter commit b519e4c, we call a different function, so fix the error message accordingly. @noreview Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b1026985fcaploop_store_diskdescriptor: fix typo, show errno1 s/Faled/Failed/ to fix a typo. 2 s/Failed/Can't/ to use a verb we tend to use more often. 3 Pass errno to ploop_err() to show why exactly we can't. This is an addition to commit b519e4c Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
b519e4c630eploop_store_diskdescriptor: fsync DiskDescriptor.xmlProblem: DiskDescriptor.xml is empty after host's hard reboot Solution: call fsync() before rename Reference: PSBM-27028 Reference: ploop@1013886PSBM-27028
Kir KolyshkinKir Kolyshkin
802af7ca006ploop copy: fix open_mount_point err handlingBefore this patch: # ploop -vvvv copy -s /dev/ploop47147 -d file [ 0.000337] Error in open_mount_point (pcopy.c:357): Can't open : No such file or directory Apparently, ploop_get_mnt_by_dev() can return 1 in case there is no error, but mount point can't be found, therefore we should check for non-zero, not just < 0. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
cdfea9d65c9ploop_copy_send(): fix potential NULL derefAs pointed out by Coverity, CID 1216781. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
c0c69ddc376ploop_copy_send(): add check for feedback_fdIf feedback_fd is specified, check that it is a pipe or a socket. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
9af38b5d5b5ploop_copy_receive(): improve fd checksUse is_fd_pipe() to check both input fd and feedback fd. Also, print fd in error message. Signed-off-by: Kir Kolyshkin <kir@openvz.org>