From owner-freebsd-fs@FreeBSD.ORG Thu Jul 18 11:28:18 2013 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8BA2FED2; Thu, 18 Jul 2013 11:28:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id F295F85A; Thu, 18 Jul 2013 11:28:17 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r6IBSEJA015801; Thu, 18 Jul 2013 14:28:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r6IBSEJA015801 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r6IBSEMo015800; Thu, 18 Jul 2013 14:28:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 18 Jul 2013 14:28:14 +0300 From: Konstantin Belousov To: Andriy Gapon Subject: Re: Deadlock in nullfs/zfs somewhere Message-ID: <20130718112814.GA5991@kib.kiev.ua> References: <51DCFEDA.1090901@FreeBSD.org> <51E59FD9.4020103@FreeBSD.org> <51E67F54.9080800@FreeBSD.org> <51E7B686.4090509@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GFPlsJ7YtLjXgs8j" Content-Disposition: inline In-Reply-To: <51E7B686.4090509@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-fs@FreeBSD.org, Adrian Chadd X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jul 2013 11:28:18 -0000 --GFPlsJ7YtLjXgs8j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 18, 2013 at 12:33:58PM +0300, Andriy Gapon wrote: > on 17/07/2013 20:19 Adrian Chadd said the following: > > On 17 July 2013 04:26, Andriy Gapon wrote: > >> One possibility is to add getnewvnode_reserve() calls before the ZFS t= ransaction > >> beginnings in the places where a new vnode/znode may have to be alloca= ted within > >> a transaction. > >> This looks like a quick and cheap solution but it makes the code somew= hat messier. > >> > >> Another possibility is to change something in VFS machinery, so that V= OP_RECLAIM > >> getting blocked for one filesystem does not prevent vnode allocation f= or other > >> filesystems. > >> > >> I could think of other possible solutions via infrastructural changes = in VFS or > >> ZFS... > >=20 > > Well, what do others think? This seems like a showstopper for systems > > with lots and lots of ZFS filesystems doing lots and lots of activity. > >=20 >=20 > Looks like others are not speaking yet :-) >=20 > My current idea is that ZFS should set MNTK_SUSPEND in zfs_suspend_fs() p= ath > before acquiring its z_teardown* locks. This should make intentions of Z= FS > visible to VFS. And thus it should prevent VOP_RECLAIM call on a suspend= ed ZFS > filesystem and that should prevent vnlru_free() getting stuck. > Hopefully this should break the deadlock cycle. >=20 > Kostik, >=20 > what is your opinion? > For your convenience here is a message with my analysis of this issue: > http://thread.gmane.org/gmane.os.freebsd.current/150889/focus=3D18534 Well, I have no opinion. Making the fs suspended, in other words, preventi= ng writers from entering the filesystem code, is probably good. I do not know zfs code to usefully comment on the approach. Note that you must drain existing writers, i.e. call vfs_write_suspend(), to set MNTK_SUSPEND. --GFPlsJ7YtLjXgs8j Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR59FNAAoJEJDCuSvBvK1ByYMP/3njOyjvWN3fDjUVHiJmFgL+ 9STNHDkzaHDTBd7TDtybGrqkljLoSrjkC9LVl6MyRwq2olJ1yhYQKmOlkaBeOaJt rnuXvyGA2Wz4XTUIZVWaV/wtEPUMPskYv60ibYx00JuOFwA/oNR7J7fp/7bPirJ6 jPwQ+W9wU/Qzls3rMmhV2owqhSIUQD8egTB3Es/5Cda/+8zjR9yoQK0KLLCU4GbY n8740XueGxZkTvM2C0ZstQ4JvRAbrRLKT7mCHadISov+ErPPwnnuWIYtYhB/gcq0 i9U5/JMNRyiTlyyDSEiePBtxf+iY9sxWYHi1hwWIWG28rLH3exEGn6kKzXB4q4Pe NzRGJB4p8drGZb4NoUAikhqquY7Jmm8to5NMJzepV9AKa2a08WSHM4SMgk60oeUq NO+XSpnazZK9Bu7shrYnlWdUjXAPzUzUlQArTRmI9cQjkEWiTzwpY2TFn6AFbvwM HUu/AdDP4EBvrW/dyAeLmgocbErqZpNLlemLTBl6I3kfgB/Ytd3VcHbWZCMgP8cS 3DDbbaPqj6eFxXqObDgp+hAPhUaFvO8RW+FH3/SMj+zGjQ9+tmW9L47hB1jHbO8z QIqXAQaAoqhATNurGVqj4qUtb3YX157Csw5+nRMTQ/IRmJghb5W5OxEALNyranmY d4655Qai0ShZPuB/v8ZD =aHUZ -----END PGP SIGNATURE----- --GFPlsJ7YtLjXgs8j--