All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: nbd-general@lists.sourceforge.net,
	Oleg Nesterov <oleg@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] nbd: Remove signal usage
Date: Tue, 10 Nov 2015 11:22:45 +0100	[thread overview]
Message-ID: <17038403.1mEsPFdYFf@adelgunde> (raw)
In-Reply-To: <20151110044617.GC22011@ZenIV.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]

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 |

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-11-10 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 15:42 [PATCH 0/4] nbd: Remove signal usage Markus Pargmann
2015-10-29 15:42 ` [PATCH 1/4] " Markus Pargmann
2015-11-10  4:46   ` Al Viro
2015-11-10 10:22     ` Markus Pargmann [this message]
2015-10-29 15:42 ` [PATCH 2/4] nbd: Timeouts are not user requested disconnects Markus Pargmann
2015-10-29 15:42 ` [PATCH 3/4] nbd: Cleanup reset of nbd and bdev after a disconnect Markus Pargmann
2015-10-29 15:42 ` [PATCH 4/4] nbd: Move flag parsing to a function Markus Pargmann
2015-11-01 19:05 ` [PATCH 0/4] nbd: Remove signal usage Oleg Nesterov
2015-11-09 11:09   ` Markus Pargmann

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=17038403.1mEsPFdYFf@adelgunde \
    --to=mpa@pengutronix.de \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd-general@lists.sourceforge.net \
    --cc=oleg@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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.