All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 3/6] c/r: [pty 2/2] support for pseudo terminals
Date: Tue, 08 Sep 2009 09:19:58 -0400	[thread overview]
Message-ID: <4AA659FE.6040808@librato.com> (raw)
In-Reply-To: <20090908085013.GQ12824-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>



Louis Rilling wrote:
> On 04/09/09 10:20 -0400, Oren Laadan wrote:
>> This patch adds support for checkpoint and restart of pseudo terminals
>> (PTYs). Since PTYs are shared (pointed to by file, and signal), they
>> are managed via objhash.
>>
>> PTYs are master/slave pairs; The code arranges for the master to
>> always be checkpointed first, followed by the slave. This is important
>> since during restart both ends are created when restoring the master.
>>
>> In this patch only UNIX98 style PTYs are supported.
>>
>> Currently only PTYs that are referenced by open files are handled.
>> Thus PTYs checkpoint starts with a file in tty_file_checkpoint(). It
>> will first checkpoint the master and slave PTYs via tty_checkpoint(),
>> and then complete the saving of the file descriptor. This means that
>> in the image file, the order of objects is: master-tty, slave-tty,
>> file-desc.
>>
>> During restart, to restore the master side, we open the /dev/ptmx
>> device and get a file handle. But at this point we don't know the
>> designated objref for this file, because the file is due later on in
>> the image stream. On the other hand, we can't just fput() the file
>> because it will close the PTY too.
>>
>> Instead, when we checkpoint the master PTY, we _reserve_ an objref
>> for the file (which won't be further used in checkpoint). Then at
>> restart, use it to insert the file to objhash.
>>
>> TODO:
>>
>> * Better sanitize input from checkpoint image on restore
>> * Check the locking when saving/restoring tty_struct state
>> * Echo position/buffer isn't saved (is it needed ?)
>> * Handle multiple devpts mounts (namespaces)
>> * Paths of ptmx and slaves are hard coded (/dev/ptmx, /dev/pts/...)
>>
>> Changelog[v1]:
>>   - Adjust include/asm/checkpoint_hdr.h for s390 architecture
>>   - Add NCC to kernel constants header (ckpt_hdr_const)
>>   - [Serge Hallyn] fix calculation of canon_datalen
>>
>> Signed-off-by: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
> 
> [...]
> 
>> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
>> index a3afa0c..b8f8d79 100644
>> --- a/drivers/char/tty_io.c
>> +++ b/drivers/char/tty_io.c
>> @@ -570,7 +582,9 @@ static void do_tty_hangup(struct work_struct *work)
>>  	set_bit(TTY_HUPPED, &tty->flags);
>>  	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
>>  
>> -	/* Account for the p->signal references we killed */
>> +	/* Account
>> +
>> +	   for the p->signal references we killed */
>>  	while (refs--)
>>  		tty_kref_put(tty);
>>  
> 
> Nit: this hunk is certainly not needed ;)

Hmm... lemme think about it ... :p

Oren.

  parent reply	other threads:[~2009-09-08 13:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04 14:20 Checkpoint/restart of ptys, pgids, and controlling tty Oren Laadan
     [not found] ` <1252074054-22241-1-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-04 14:20   ` [PATCH 1/6] c/r: [objhash] add ckpt_obj_reserve() Oren Laadan
2009-09-04 14:20   ` [PATCH 2/6] c/r: [pty 1/2] allow allocation of desired pty slave Oren Laadan
     [not found]     ` <1252074054-22241-3-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-04 15:26       ` Serge E. Hallyn
     [not found]         ` <20090904152644.GA15253-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-04 16:08           ` Oren Laadan
2009-09-08  8:09           ` Louis Rilling
     [not found]             ` <20090908080944.GP12824-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2009-09-08 13:19               ` Oren Laadan
     [not found]                 ` <4AA659C7.5020700-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-08 14:04                   ` Louis Rilling
2009-09-04 14:20   ` [PATCH 3/6] c/r: [pty 2/2] support for pseudo terminals Oren Laadan
     [not found]     ` <1252074054-22241-4-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-04 16:21       ` Serge E. Hallyn
2009-09-08  8:50       ` Louis Rilling
     [not found]         ` <20090908085013.GQ12824-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2009-09-08 13:19           ` Oren Laadan [this message]
2009-09-04 14:20   ` [PATCH 4/6] c/r: tighten logic to protect against bogus pids in input Oren Laadan
     [not found]     ` <1252074054-22241-5-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-08  1:09       ` Serge E. Hallyn
2009-09-04 14:20   ` [PATCH 1/3] mktree: add support to ghost tasks (TASK_GHOST) Oren Laadan
2009-09-04 14:20   ` [PATCH 2/3] test/pgrp.c: add test case for process-groups Oren Laadan
2009-09-04 14:20   ` [PATCH 3/3] restart: correctly handle pgid/ppid/sid = 0 Oren Laadan
     [not found] ` <1252074054-22241-6-git-send-email-orenl@librato.com>
     [not found]   ` <1252074054-22241-6-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-08  3:04     ` [PATCH 5/6] c/r: correctly restore pgid Serge E. Hallyn
     [not found]       ` <20090908030445.GB16460-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-08 13:33         ` Oren Laadan
     [not found]           ` <4AA65D10.6000702-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-08 14:00             ` Serge E. Hallyn
     [not found]               ` <20090908140056.GA873-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-08 16:40                 ` Oren Laadan
     [not found] ` <1252074054-22241-7-git-send-email-orenl@librato.com>
     [not found]   ` <1252074054-22241-7-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-08  3:21     ` [PATCH 6/6] c/r: support for controlling terminal and job control Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AA659FE.6040808@librato.com \
    --to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.