- 12 Sep, 2012 16 commits
-
-
Cyrill Gorcunov authored
Usually the PTYs represent a pair of links -- master peer and slave peer. Master peer must be opened before slave. Internally, when kernel creates master peer it also generates a slave interface in a form of /dev/pts/N, where N is that named pty "index". Master/slave connection unambiguously identified by this index. Still, one master can carry multiple slaves -- for example a user opens one master via /dev/ptmx and appropriate /dev/pts/N in sequence. The result will be the following master `- slave 1 `- slave 2 both slave will have same master index but different file descriptors. Still inside the kernel pty parameters are same for both slaves. Thus only one slave parameters should be restored, there is no need to carry all parameters for every slave peer we've found. Not yet addressed problems: - At moment of restore the master peer might be already closed for any reason so to resolve such problem we need to open a fake master peer with proper index and hook a slave on it, then we close master peer. - Need to figure out how to deal with ttys which have some data in buffers not yet flushed, at moment this data will be simply lost during c/r - Need to restore control terminals - Need to fetch tty flags such as exclusive/packet-mode, this can't be done without kernel patching [ avagin@: - ideas on contol terminals restore - overall code redesign and simplification ] v4: - drop redundant pid from dump_chrdev - make sure optional fown is passed on regular ptys - add a comments about zeroifying termios - get rid of redundant empty line in files.c v5 (by avagin@): - complete rework of tty image format, now we have two files -- tty.img and tty-info.img. The idea behind to reduce data being stored. v6 (by xemul@): - packet mode should be set to true in image, until properly fetched from the kernel - verify image data on retrieval Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> CC: Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Cyrill Gorcunov authored
When we will be restoring ttys we need that restore procedure for master peers will be yielded earlier than for slave peers due to ttys specifics. With this commit we introduce @tty_slaves list which will allow us to order tty file restore procesure. Because we need to fetch which list to be used depending on tty type this patch extend select_ps_list with fdinfo_list_entry parameter. v2 (by xemul@): - make sure the epoll list is still last Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Pavel Emelyanov authored
This is normal situation -- eventpoll fd may have no fds attached thus resulting in empty fdinfo file. Report OK in that case. Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
Otherwise a transport fd may be added to eventfd... Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
It will be used for restoring epollfd. Currently a transport fd may be added to epollfd. epollfd should be populated, when all descriptors were already received. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
I tried to fix that by: commit bc2ac71c Author: Andrey Vagin <avagin@openvz.org> Date: Wed Sep 12 15:16:39 2012 +0400 sk-unix: don't add a socket in a second time but made a mistake and now a peer would be added only if it's in a list. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
Before we checked only one connection. With this patch the test reproduces a bug: Error (sk-unix.c:395): BUG at sk-unix.c:395 Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
A socket can be added in a list two times, if two other sockets are connected to it. This patch fixes a problem: Error (sk-unix.c:395): BUG at sk-unix.c:395 Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
* A message about external sockets is printed before any action. * Add a message, when a peer is added in a list of sockets. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
$ make cleanout stop rm -f -r *.pid *.out* *.test* *.state ./conntracks --statefile=conntracks.state --outfile=conntracks.out start make: *** [conntracks.state] Error 1 Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrey Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
`< $FILE` isn't posix compatible and doesn't work in dash Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrey Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
fix obvious bashisms to make script more portable Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrey Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
Linux has it since v3.2 cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -I../../lib packet_sock.c ../../lib/libzdtmtst.a -o packet_sock packet_sock.c:70:8: error: redefinition of ‘struct tpacket_req3’ In file included from packet_sock.c:23:0: /usr/include/linux/if_packet.h:245:8: note: originally defined here Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrew Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
On some systems PAGE_SIZE is declared as sysconf(_SC_PAGESIZE) in <sys/user.h> this is non-constant expression, so it cannot be used in type declarations. cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -c -o ns.o ns.c ns.c:124:7: error: variably modified ‘stack’ at file scope Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrew Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Konstantin Khlebnikov authored
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -c -o msg.o msg.c msg.c: In function ‘test_msg’: msg.c:40:6: error: variable ‘len’ set but not used [-Werror=unused-but-set-variable] Signed-off-by:
Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by:
Andrew Vagin <avagin@parallels.com> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
- 11 Sep, 2012 10 commits
-
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Pavel Emelyanov authored
Check for post_open callback presense before any other checks. Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Pavel Emelyanov authored
Same again -- for code to be cleaner. Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Pavel Emelyanov authored
Just for cleaner (from my pov) code. Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Cyrill Gorcunov authored
Otherwise I get | parasite.c: In function ‘parasite_service’: | parasite.c:383:11: error: ‘fd’ may be used uninitialized in this function [-Werror=uninitialized] | cc1: all warnings being treated as errors Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
A few test check restoring of file descriptors to a one file struct. Here is better to check, that a few file struct can be linked to one unlinked file. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
A ghost file is used for restoring descriptors of an unlinked file. It is created, opened and deleted. Currently ghost files are collected in root task and then removed by crtools when everybody is restored. This scheme doesn't work, ghost_file_list is not shared, plus tasks may live in different mount namespace. It was broken by the following commit: bd4e5d2f restore: prepare shared objects after initializing namespaces We can't just move clear_ghost_files(), because we need to wait, until all processes have not opened a ghost file. We can add one more global barrier or move clear_ghost_files() in a restore code bellow an existent barrier. Here is a better sollution, a gost file is deleted by the last user. v2: Use the type atomic_t and fix a commit message. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
This code is copied from the Linux kernel. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
It's a struct to prevent using usual arithmetic operations. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
- 10 Sep, 2012 1 commit
-
-
Andrey Vagin authored
Actually a gurad page is a part of a stack vma and we don't want to remap it by a restorer vma. The crtools on restore find a place for a restorer vma, which will not intersect with other VMAs. A guard page is a part of a stack VMA, if we don't take into account it, we can place the restorer VMA on it and that case is a bug. Would not this lead to situation where we expand stack manually? Every new c/r cycle add one page to the bottom of stack, no? No: strace: mmap(0x5f4d0e0cc000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x5f4d0e0cc000 /proc/PID/maps: 5f4d0e0cd000-5f4d0e0cd000 rw-p 00000000 00:00 0 . Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
- 07 Sep, 2012 10 commits
-
-
Andrey Vagin authored
The problem is to get a virtual pid for zombies. This code gets two list of children from current and target pidns. Then it removes alive task from the second list and dumps remaining zombies. A procfs from a target pidns is needed for dumping zombies, crtools gets it from parasite code. v2: Fix comment and get proc fd from a root task Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
This proc will be used for dumping zombies from pidns. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
Here is a bit mess, because we used unsigned int instead of pid_t. A negative value is used for uninitialized PID's variables. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
When a pidns is dumped, crtools uses procfs from this pidns for getting information about zombies. v2: Use close_proc() instead of restore_proc_fd(). A current proc will be opened again, if it's required. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
It will be used for dumping zombies. v2: Add a fast path, if /proc belongs to the target pipns. it's usually for CT. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
pstree_item contains virtual and real pid and we want to get children by both of this pids. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
I don't like surprises. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
/proc/PID/maps can contains not up to date information about a stack vma. A kernel marks a VMA as stack, if thread_struct->usersp is in it, but usersp is updated, when a process calls a syscall. This problem is occured, when we try to dump/restore a process in a loop. When a restorer resumes a process, a restorer vma will be marked as stack. A thread stack should not be marked as stack, because its vma is mapped w/o MAP_GROWSDOWN. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
All per task images contains a virtual pid. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Andrey Vagin authored
It looks better and the next patches adds more checks before memory allocations. Signed-off-by:
Andrey Vagin <avagin@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
- 05 Sep, 2012 3 commits
-
-
Cyrill Gorcunov authored
For easier transition to tty c/r. We will need more types here, thus using switch statement makes code a bit easier to read. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Cyrill Gorcunov authored
Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-
Cyrill Gorcunov authored
Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
-