[RFC][PATCH 6/6]: /dev/tty tweak in init_dev()

Serge E. Hallyn serue at us.ibm.com
Wed Aug 6 10:56:45 PDT 2008


Quoting sukadev at us.ibm.com (sukadev at us.ibm.com):
> 
> From: Sukadev Bhattiprolu <sukadev at us.ibm.com>
> Subject: [RFC][PATCH 6/6]: /dev/tty tweak in init_dev()
> 
> When opening /dev/tty, __tty_open() finds the tty using get_current_tty().
> When __tty_open() calls init_dev(), init_dev() tries to 'find' the tty
> again from devpts.  Is that really necessary ?
> 
> The problem with asking devpts again is that with multiple mounts, devpts
> cannot find the tty without knowing the specific mount instance. We can't
> find the mount instance of devpts, since the inode of /dev/tty is in a
> different filesystem.
> 
> ---
>  drivers/char/tty_io.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.26-rc8-mm1/drivers/char/tty_io.c
> ===================================================================
> --- linux-2.6.26-rc8-mm1.orig/drivers/char/tty_io.c	2008-08-04 17:25:20.000000000 -0700
> +++ linux-2.6.26-rc8-mm1/drivers/char/tty_io.c	2008-08-04 17:26:34.000000000 -0700
> @@ -2066,7 +2066,10 @@ static int init_dev(struct tty_driver *d
> 
>  	/* check whether we're reopening an existing tty */
>  	if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
> -		tty = devpts_get_tty(inode, idx);
> +		if (inode->i_rdev == MKDEV(TTYAUX_MAJOR, 0))
> +			tty = *ret_tty;

I don't understand this.  ret_tty is for returning tty.  For instance in
_ptmx_open() it's passed in completely uninitialized.  Isn't it
dereferenced later in init_dev?

And what you're doing here doesn't really match your patch intro, but
the patch intro doesn't really say what the patch does, it just lists a
problem.  So I'm 100% unclear on what your intent here is.

> +		else
> +			tty = devpts_get_tty(inode, idx);
>  		/*
>  		 * If we don't have a tty here on a slave open, it's because
>  		 * the master already started the close process and there's


More information about the Containers mailing list