Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbbKJKXX (ORCPT ); Tue, 10 Nov 2015 05:23:23 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:36604 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbbKJKXV (ORCPT ); Tue, 10 Nov 2015 05:23:21 -0500 From: Markus Pargmann To: Al Viro Cc: nbd-general@lists.sourceforge.net, Oleg Nesterov , Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] nbd: Remove signal usage Date: Tue, 10 Nov 2015 11:22:45 +0100 Message-ID: <17038403.1mEsPFdYFf@adelgunde> User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: <20151110044617.GC22011@ZenIV.linux.org.uk> References: <1446133360-30652-1-git-send-email-mpa@pengutronix.de> <1446133360-30652-2-git-send-email-mpa@pengutronix.de> <20151110044617.GC22011@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1773622.lZ0Y9IZRso"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-SA-Exim-Connect-IP: 2001:67c:670:100:a61f:72ff:fe68:75ba X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2709 Lines: 84 --nextPart1773622.lZ0Y9IZRso Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" 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: > > =09del_timer_sync(&nbd->timeout_timer); > > + > > +out: > > +=09spin_unlock_irq(&nbd->sock_lock); >=20 > ... and in its callback we have this: >=20 > > @@ -148,17 +155,15 @@ static void nbd_xmit_timeout(unsigned long ar= g) > > =20 > > =09nbd->disconnect =3D true; > > =20 > > -=09spin_lock_irqsave(&nbd->tasks_lock, flags); > > +=09spin_lock_irqsave(&nbd->sock_lock, flags); >=20 > * 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() >=20 > Deadlock... Thank you. Yes that locking block in sock_shutdown is to large. And pro= bably 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 i= nto this and post a v2. Thanks, Markus =2D-=20 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-555= 5 | --nextPart1773622.lZ0Y9IZRso Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJWQcV9AAoJEEpcgKtcEGQQ1mkQAL5xpy3R6R1UJ38aiDu9ndHu UWtTy1ooD+Csu+gdpanR8lapRmiTtqvbbdhvLCYHhuHXRNCN3eE4uYY8YxI0U3DA 7h+SJo6nIWUdyVVSdan8Z3JUSb3OPoS06IDBcCo/I5WbZxZ+qD3xdiHMpVnUaxTu /HFrBNlKP6/RKB2guwoqXHDnxV1ehVI1ze+BrAELzIGAHtQ+w19isdBbyYnyRIol sg5NUNqLCtpFedXqYs+LRasbrs9UHsIj8uz3VoZf35LgFULpwV4YvM5efv1MtllZ QKYQQBu9/T6Tjj8JNiUmIGIQSgYueio586PBXM4KNxX27vEMGiGnXunl+9LzPlfL 5R1cycjW4TOABsTkX1lKZ9oWbXCphft/PmkTlacYq2texoXDQooRBV33Xb3quZzT 6jmOS7a4MYxkOSndAnvDOJT9HJiFhFpLWOwBJRoQtmcXvSF9oRUKEwu9VqxYnPyL NM50dCKjFzNgp1smT9jXocJvqK2CriDraijbolP623X/B+XP6Viil6R0XRxGBAYq Zb2dSpAE1Vr0YhS2dEjGuDEarIBkmU5JQZc0+oDhTSLbcwA86+utsoKk7WK5i/Mn RrHgtiek3p+evBDYnpDKY/BfbQXsYkopVnJ8JeOVcVfZoIr06nvgEvYTMsoB5Mjc aDhDPv1kMhT+oxfIFC2o =bs5z -----END PGP SIGNATURE----- --nextPart1773622.lZ0Y9IZRso-- -- 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/