All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
	Peter Hurley <peter@hurleysoftware.com>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: linux-next: manual merge of the tty tree with the tty.current tree
Date: Sun, 7 Feb 2016 18:21:52 -0800	[thread overview]
Message-ID: <20160208022152.GA21591@kroah.com> (raw)
In-Reply-To: <20160208131629.20a16097@canb.auug.org.au>

On Mon, Feb 08, 2016 at 01:16:29PM +1100, Stephen Rothwell wrote:
> Hi Greg,
> 
> Today's linux-next merge of the tty tree got a conflict in:
> 
>   drivers/tty/tty_io.c
> 
> between commit:
> 
>   e9036d066236 ("tty: Drop krefs for interrupted tty lock")
> 
> from the tty.current tree and commit:
> 
>   d6203d0c7b73 ("tty: Refactor tty_open()")
> 
> from the tty tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/tty/tty_io.c
> index a7eacef1bd22,8d26ed79bb4c..000000000000
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@@ -2004,6 -2009,69 +2009,68 @@@ static struct tty_driver *tty_lookup_dr
>   }
>   
>   /**
> +  *	tty_open_by_driver	-	open a tty device
> +  *	@device: dev_t of device to open
> +  *	@inode: inode of device file
> +  *	@filp: file pointer to tty
> +  *
> +  *	Performs the driver lookup, checks for a reopen, or otherwise
> +  *	performs the first-time tty initialization.
> +  *
> +  *	Returns the locked initialized or re-opened &tty_struct
> +  *
> +  *	Claims the global tty_mutex to serialize:
> +  *	  - concurrent first-time tty initialization
> +  *	  - concurrent tty driver removal w/ lookup
> +  *	  - concurrent tty removal from driver table
> +  */
> + static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
> + 					     struct file *filp)
> + {
> + 	struct tty_struct *tty;
> + 	struct tty_driver *driver = NULL;
> + 	int index = -1;
> + 	int retval;
> + 
> + 	mutex_lock(&tty_mutex);
> + 	driver = tty_lookup_driver(device, filp, &index);
> + 	if (IS_ERR(driver)) {
> + 		mutex_unlock(&tty_mutex);
> + 		return ERR_CAST(driver);
> + 	}
> + 
> + 	/* check whether we're reopening an existing tty */
> + 	tty = tty_driver_lookup_tty(driver, inode, index);
> + 	if (IS_ERR(tty)) {
> + 		mutex_unlock(&tty_mutex);
> + 		goto out;
> + 	}
> + 
> + 	if (tty) {
> + 		mutex_unlock(&tty_mutex);
> + 		retval = tty_lock_interruptible(tty);
> ++		tty_kref_put(tty);  /* drop kref from tty_driver_lookup_tty() */
> + 		if (retval) {
> + 			if (retval == -EINTR)
> + 				retval = -ERESTARTSYS;
> + 			tty = ERR_PTR(retval);
> + 			goto out;
> + 		}
>  -		/* safe to drop the kref from tty_driver_lookup_tty() */
>  -		tty_kref_put(tty);
> + 		retval = tty_reopen(tty);
> + 		if (retval < 0) {
> + 			tty_unlock(tty);
> + 			tty = ERR_PTR(retval);
> + 		}
> + 	} else { /* Returns with the tty_lock held for now */
> + 		tty = tty_init_dev(driver, index);
> + 		mutex_unlock(&tty_mutex);
> + 	}
> + out:
> + 	tty_driver_kref_put(driver);
> + 	return tty;
> + }
> + 
> + /**
>    *	tty_open		-	open a tty device
>    *	@inode: inode of device file
>    *	@filp: file pointer to tty

Peter warned me this was going to happen...

Peter, is the merge above correct?

thanks,

greg k-h

  reply	other threads:[~2016-02-08  2:27 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08  2:16 linux-next: manual merge of the tty tree with the tty.current tree Stephen Rothwell
2016-02-08  2:21 ` Greg KH [this message]
2016-02-08  2:53   ` Peter Hurley
2016-04-01  0:23   ` Peter Hurley
2016-04-01  0:47     ` [PATCH] tty: Fix merge of "tty: Refactor tty_open()" Peter Hurley
2016-04-01  3:49     ` linux-next: manual merge of the tty tree with the tty.current tree Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2024-04-19  4:19 Stephen Rothwell
2024-04-19  6:09 ` Greg KH
2024-04-23 11:24 ` Greg KH
2024-04-11  3:57 Stephen Rothwell
2024-04-11  4:17 ` Stephen Rothwell
2024-04-11  4:38   ` Greg KH
2024-04-11 10:40   ` Andy Shevchenko
2023-10-04  1:55 Stephen Rothwell
2023-10-04  2:14 ` Stephen Rothwell
2023-10-04  6:38   ` Greg KH
2023-10-16  8:20     ` Greg KH
2020-09-17  6:09 Stephen Rothwell
2020-09-17  6:34 ` Greg KH
2019-12-18  0:49 Stephen Rothwell
2019-12-18  7:05 ` Greg KH
2017-08-02  4:26 Stephen Rothwell
2017-08-04  1:02 ` Greg KH
2017-08-14 22:17 ` Greg KH
2017-03-20  2:28 Stephen Rothwell
2017-03-20  9:21 ` Dmitry Vyukov
2017-03-20  9:26   ` Dmitry Vyukov
2017-03-29  5:51     ` Greg KH
2017-03-30  3:46     ` Michael Neuling
2017-03-30 12:17       ` Dmitry Vyukov
2015-05-25  8:19 Stephen Rothwell
2015-05-25 16:28 ` Greg KH
2015-05-26 11:08   ` Dave Martin
2014-11-26  7:12 Stephen Rothwell
2014-11-26 19:51 ` Greg KH
2014-11-10  4:49 Stephen Rothwell
2014-11-10  5:08 ` Greg KH
2013-01-17  2:07 Stephen Rothwell
2013-01-18  1:27 ` Greg KH
2012-04-19  4:59 Stephen Rothwell
2012-04-19 20:07 ` Greg KH
2012-04-23 16:40 ` Greg KH
2011-11-18  3:30 Stephen Rothwell
2011-11-18  8:41 ` Jiri Slaby
2011-11-18 16:18 ` Greg KH
2011-11-27  4:08 ` Greg KH

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=20160208022152.GA21591@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=sfr@canb.auug.org.au \
    /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.