From owner-freebsd-fs@FreeBSD.ORG Mon Dec 16 10:08:38 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4845872A for ; Mon, 16 Dec 2013 10:08:38 +0000 (UTC) Received: from krichy.tvnetwork.hu (unknown [IPv6:2a01:be00:0:2::10]) by mx1.freebsd.org (Postfix) with ESMTP id 07DDD1E51 for ; Mon, 16 Dec 2013 10:08:37 +0000 (UTC) Received: by krichy.tvnetwork.hu (Postfix, from userid 1000) id B3E365E0E; Mon, 16 Dec 2013 11:08:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by krichy.tvnetwork.hu (Postfix) with ESMTP id ADB555E0D for ; Mon, 16 Dec 2013 11:08:11 +0100 (CET) Date: Mon, 16 Dec 2013 11:08:11 +0100 (CET) From: krichy@tvnetwork.hu To: freebsd-fs@freebsd.org Subject: kern/184677 Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1030603365-1718570176-1387188491=:7004" X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 10:08:38 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1030603365-1718570176-1387188491=:7004 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Dear devs, I've attached a patch, which makes the recursive lockmgr disappear, and makes the reported bug to disappear. I dont know if I followed any guidelines well, or not, but at least it works for me. Please some ZFS/FreeBSD fs expert review it, and fix it where it needed. But unfortunately, my original problem is still not solved, maybe the same as Ryan's: http://lists.freebsd.org/pipermail/freebsd-fs/2013-December/018707.html Tracing the problem down is that zfsctl_snapdir_lookup() tries to acquire spa_namespace_lock while when finishing a zfs send -R does a zfsdev_close(), and that also holds the same mutex. And this causes a deadlock scenario. I looked at illumos's code, and for some reason they use another mutex on zfsdev_close(), which therefore may not deadlock with zfsctl_snapdir_lookup(). But I am still investigating the problem. I would like to help making ZFS more stable on freebsd also with its whole functionality. I would be very thankful if some expert would give some advice, how to solve these bugs. PJD, Steven, Xin? Thanks in advance, Kojedzinszky Richard Euronet Magyarorszag Informatikai Zrt. --1030603365-1718570176-1387188491=:7004 Content-Type: TEXT/x-diff; name=184677.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=184677.patch Y29tbWl0IDc5NjVlMDFmY2E3OTE4N2Q4MTViOGE4NjU3MGY1MDU0N2QwMGU1 MzENCkF1dGhvcjogUmljaGFyZCBLb2plZHppbnN6a3kgPGtyaWNoeUBjZmxp bnV4Lmh1Pg0KRGF0ZTogICBNb24gRGVjIDE2IDA5OjU5OjU3IDIwMTMgKzAx MDANCg0KICAgIFpGUyBsb2NrIG9yZGVyaW5nIGZpeA0KDQpkaWZmIC0tZ2l0 IGEvc3lzL2NkZGwvY29tcGF0L29wZW5zb2xhcmlzL2tlcm4vb3BlbnNvbGFy aXNfbG9va3VwLmMgYi9zeXMvY2RkbC9jb21wYXQvb3BlbnNvbGFyaXMva2Vy bi9vcGVuc29sYXJpc19sb29rdXAuYw0KaW5kZXggOTQzODNkNi4uMjI1NTIx YSAxMDA2NDQNCi0tLSBhL3N5cy9jZGRsL2NvbXBhdC9vcGVuc29sYXJpcy9r ZXJuL29wZW5zb2xhcmlzX2xvb2t1cC5jDQorKysgYi9zeXMvY2RkbC9jb21w YXQvb3BlbnNvbGFyaXMva2Vybi9vcGVuc29sYXJpc19sb29rdXAuYw0KQEAg LTgxLDYgKzgxLDggQEAgdHJhdmVyc2Uodm5vZGVfdCAqKmN2cHAsIGludCBs a3R5cGUpDQogCSAqIHByb2dyZXNzIG9uIHRoaX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