Subject: Re: linux-next: manual merge of the tty tree with Linus' tree

From: Jiri Slaby <[email-masked]>
Date: Mon, 16 Mar 2020 07:34:11 +0100

On 10. 03. 20, 4:40, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tty tree got a conflict in:
> 
>   drivers/tty/vt/selection.c
> 
> between commits:
> 
>   4b70dd57a15d ("vt: selection, push console lock down")
>   e8c75a30a23c ("vt: selection, push sel_lock up")
> 
> from Linus' tree and commits:
> 
>   9256d09f1da1 ("vt: selection, create struct from console selection globals")
>   bc80932cc25a ("vt: selection, indent switch-case properly")
> 
> from the tty tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary.
> This is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

I checked the result previously, but now I see a double lock there. Did
something change?

Anyway, vc_sel.lock cannot be taken in both set_selection_kernel and
__set_selection_kernel:

--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -219,7 +219,6 @@ static int __set_selection_kernel(struct
tiocl_selection *v, struct tty_struct *
        if (ps > pe)    /* make vc_sel.start <= vc_sel.end */
                swap(ps, pe);

-       mutex_lock(&vc_sel.lock);
        if (vc_sel.cons != vc_cons[fg_console].d) {
                clear_selection();
                vc_sel.cons = vc_cons[fg_console].d;

thanks,
-- 
js
suse labs