Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266225 > unrolled thread

Re: [PATCH 1/4] nbd: Remove signal usage

Started byAl Viro <viro@ZenIV.linux.org.uk>
First post2015-11-10 05:50 +0100
Last post2015-11-10 11:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/4] nbd: Remove signal usage Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-10 05:50 +0100
    Re: [PATCH 1/4] nbd: Remove signal usage Markus Pargmann <mpa@pengutronix.de> - 2015-11-10 11:30 +0100

#1266225 — Re: [PATCH 1/4] nbd: Remove signal usage

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2015-11-10 05:50 +0100
SubjectRe: [PATCH 1/4] nbd: Remove signal usage
Message-ID<qt92y-kt-7@gated-at.bofh.it>
On Thu, Oct 29, 2015 at 04:42:37PM +0100, Markus Pargmann wrote:
>  	del_timer_sync(&nbd->timeout_timer);
> +
> +out:
> +	spin_unlock_irq(&nbd->sock_lock);

... and in its callback we have this:

> @@ -148,17 +155,15 @@ static void nbd_xmit_timeout(unsigned long arg)
>  
>  	nbd->disconnect = true;
>  
> -	spin_lock_irqsave(&nbd->tasks_lock, flags);
> +	spin_lock_irqsave(&nbd->sock_lock, flags);

* CPU 1 enters sock_shutdown() and grabs ->sock_lock.
* on CPU2 the timer hits and we enter the callback, where we spin on that
spinlock.
* in the meanwhile, CPU1 calls del_timer_sync()

Deadlock...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1266387

FromMarkus Pargmann <mpa@pengutronix.de>
Date2015-11-10 11:30 +0100
Message-ID<qtelA-3Oi-27@gated-at.bofh.it>
In reply to#1266225

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Tuesday 10 November 2015 04:46:18 Al Viro wrote:
> On Thu, Oct 29, 2015 at 04:42:37PM +0100, Markus Pargmann wrote:
> >  	del_timer_sync(&nbd->timeout_timer);
> > +
> > +out:
> > +	spin_unlock_irq(&nbd->sock_lock);
> 
> ... and in its callback we have this:
> 
> > @@ -148,17 +155,15 @@ static void nbd_xmit_timeout(unsigned long arg)
> >  
> >  	nbd->disconnect = true;
> >  
> > -	spin_lock_irqsave(&nbd->tasks_lock, flags);
> > +	spin_lock_irqsave(&nbd->sock_lock, flags);
> 
> * CPU 1 enters sock_shutdown() and grabs ->sock_lock.
> * on CPU2 the timer hits and we enter the callback, where we spin on that
> spinlock.
> * in the meanwhile, CPU1 calls del_timer_sync()
> 
> Deadlock...

Thank you. Yes that locking block in sock_shutdown is to large. And probably
the del_timer_sync() isn't necessary, we can just use del_timer().

It may even be possible to remove the sock_lock completely. Will look into this
and post a v2.

Thanks,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web