From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:35561 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753643AbcGHBEA (ORCPT ); Thu, 7 Jul 2016 21:04:00 -0400 From: NeilBrown To: Anton Altaparmakov , Christoph Hellwig Date: Fri, 08 Jul 2016 11:03:48 +1000 Cc: Jens Axboe , Theodore Ts'o , linux-fsdevel , Sougata Santra Subject: Re: Device removal crash problems In-Reply-To: <1D4D1B85-F772-4795-A938-852F46969499@tuxera.com> References: <1D4D1B85-F772-4795-A938-852F46969499@tuxera.com> Message-ID: <87eg75eya3.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain On Mon, Jun 13 2016, Anton Altaparmakov wrote: > Hi Christoph, > > I think the reason the storage unplug crashes came back in 4.1 kernel after your work in 4.0 kernel to fix them is this commit: 6cd18e711dd8 "block: destroy bdi before blockdev is unregistered." > > The fix was to basically violate the lifetime rules/reference counting you put in place and destroy the bdi before the reference count reaches zero which means we are back at square one! The whole point of the reference count was specifically so that devices are not destroyed before the reference count becomes zero. Or at least that was my understanding/assumption... > > The solution should have perhaps been to fix MD and Loop drivers rather than to break the entire kernel all over again and then patch up ext4 again (commit bdfe0cbd746aa9b2509c2f6d6be17193cf7facd7). > > The check in ext4 is not perfect because it is a race condition - if you unplug at same time as the check is happening you can still get the kernel to crash. I grant you it is a very small race window but it is there. > > What do you think? Is this problem fixed by Commit: b02176f30cd3 ("block: don't release bdi while request_queue has live references") (in 4.3-rc7)? With that patch the unregistering is done early enough for md and loop, but the freeing should be done late enough to not inconvenience filesystems. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXfvv0AAoJEDnsnt1WYoG5ICoP/2Gr/jpTmwnB5ZZlPUiXeXct /9nMErIAK0GDLLUH9VqxvXiN81beeudVPcMmnlM7D+5gtQwvB5cfIK9QBSyMJe60 IPqK8mIHuLG9TlnRR1RBb34h+7e/hIYMpc7IN/KiprKpC3RBtyvlQBeyxabcHzGQ YFb33Air5NTeQMjWPR6nwYqqecVY2znbfZX4LpxhqK4pPcEqCX2zIEVmMOXcQcaG nYUExBlbVWXgxNdx4P6a7MvoizeRqqex2b60aaYZj6OtSU550Iw8c1GfgeD1wEBR DU0CZj3fjijY3e90YOu0f5hUeep013Z1t54mOTG5TlmnkNvX8PkuFdiFjQQ99+Bf lO1oAV7Tj6HJhegsSzzh/rjmxKZLkw/bL0hhs+5lHPt9buL5sYS8UUMabQpDqxCR /NkkWI3Rr5MxntDaJ1ym0PBFVbEtMBZzAIkBbA0KAxm8prkDXKW4bVKber84lnky D2RkvhPUfKg+wfBiEW5hmxroq8dVS97hx/s15Vnzu0vYmRcLkoRCxy8BVq2UJu6v 9mVh3fA9qntLEYAlUV9afAKKVFBTImapSn7HhRD//kKDctdjGQpBQl+IPjLl2qV6 /hzRdpKPJkecj36EmCPYjgZhNmlBILsMiQmbMDDpyHiJMpMFTTC4JqKuRPdKL/WR q1kO3Km+rBIJI7UZyZLK =C3Jw -----END PGP SIGNATURE----- --=-=-=--