[lxc-devel] [PATCH] fix console deadlocks
Stéphane Graber
stgraber at ubuntu.com
Fri Sep 20 20:07:33 UTC 2013
On Fri, Sep 20, 2013 at 02:48:40PM -0500, Serge Hallyn wrote:
> These might be a bit controversial. The process lock was held
> for some long periods of time for tweaking consoles. These
> can deadlock with some of lock holds I introduced recently. I
> would argue that if two threads are fighting over the console,
> you're gonna have trouble anyway, and the process locks here
> weren't saving us from anything. If we want to do a console
> lock then we should probably introduce a new lock - maybe held
> for the duration of a lxc-start with console or a lxc-console.
> Actually that's probably a good idea... But here I just drop
> the locks which make lxc-start-ephemeral deadlock.
>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/console.c | 11 -----------
> 1 file changed, 11 deletions(-)
>
> diff --git a/src/lxc/console.c b/src/lxc/console.c
> index a32e9cf..78be403 100644
> --- a/src/lxc/console.c
> +++ b/src/lxc/console.c
> @@ -103,13 +103,10 @@ void lxc_console_sigwinch(int sig)
> struct lxc_list *it;
> struct lxc_tty_state *ts;
>
> - process_lock();
> -
> lxc_list_for_each(it, &lxc_ttys) {
> ts = it->elem;
> lxc_console_winch(ts);
> }
> - process_unlock();
> }
>
> static int lxc_console_cb_sigwinch_fd(int fd, void *cbdata,
> @@ -423,7 +420,6 @@ int lxc_console_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
> struct lxc_tty_info *tty_info = &conf->tty_info;
> struct lxc_console *console = &conf->console;
>
> - process_lock();
> if (*ttyreq == 0) {
> if (lxc_console_peer_proxy_alloc(console, sockfd) < 0)
> goto out;
> @@ -458,7 +454,6 @@ out_tty:
> tty_info->pty_info[ttynum - 1].busy = sockfd;
> masterfd = tty_info->pty_info[ttynum - 1].master;
> out:
> - process_unlock();
> return masterfd;
> }
>
> @@ -476,7 +471,6 @@ void lxc_console_free(struct lxc_conf *conf, int fd)
> struct lxc_tty_info *tty_info = &conf->tty_info;
> struct lxc_console *console = &conf->console;
>
> - process_lock();
> for (i = 0; i < tty_info->nbtty; i++) {
> if (tty_info->pty_info[i].busy == fd)
> tty_info->pty_info[i].busy = 0;
> @@ -486,7 +480,6 @@ void lxc_console_free(struct lxc_conf *conf, int fd)
> lxc_mainloop_del_handler(console->descr, console->peerpty.slave);
> lxc_console_peer_proxy_free(console);
> }
> - process_unlock();
> }
>
> static void lxc_console_peer_default(struct lxc_console *console)
> @@ -713,9 +706,7 @@ int lxc_console(struct lxc_container *c, int ttynum,
> return -1;
> }
>
> - process_lock();
> ttyfd = lxc_cmd_console(c->name, &ttynum, &masterfd, c->config_path);
> - process_unlock();
> if (ttyfd < 0) {
> ret = ttyfd;
> goto err1;
> @@ -770,9 +761,7 @@ int lxc_console(struct lxc_container *c, int ttynum,
> goto err4;
> }
>
> - process_lock();
> ret = lxc_mainloop(&descr, -1);
> - process_unlock();
> if (ret) {
> ERROR("mainloop returned an error");
> goto err4;
> --
> 1.8.3.2
>
>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130920/28b6cad3/attachment.pgp>
More information about the lxc-devel
mailing list