From owner-freebsd-stable@FreeBSD.ORG Wed Apr 25 21:34:13 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 126DE1065670; Wed, 25 Apr 2012 21:34:13 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id A21658FC22; Wed, 25 Apr 2012 21:34:12 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAFNsmE+DaFvO/2dsb2JhbABFFoVSrG2CCQEBBSMEUhsOChEZAgRVBogiC6hOkwWPSIEYBI51hwaBEY8tgwU X-IronPort-AV: E=Sophos;i="4.75,483,1330923600"; d="scan'208";a="166639981" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 25 Apr 2012 17:34:05 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id A5648B413F; Wed, 25 Apr 2012 17:34:05 -0400 (EDT) Date: Wed, 25 Apr 2012 17:34:05 -0400 (EDT) From: Rick Macklem To: Oliver Brandmueller Message-ID: <1587904922.3402243.1335389645650.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20120424142751.GV65313@e-Gitt.NET> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3402242_1883470986.1335389645646" X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: freebsd-stable@freebsd.org Subject: Re: 9-STABLE, ZFS, NFS, ggatec - suspected memory leak X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2012 21:34:13 -0000 ------=_Part_3402242_1883470986.1335389645646 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Oliver Brandmueller wrote: > Hi, > > After figuring an easy way to repeat the behaviour and hunting it down > to the combination of ZFS+newNFS and removal of files or directories I > opened PR kern/167266 > Good work isolating this! I now see the problem. The new NFS server code assumed that VOP_LOOKUP() calls would not set SAVENAME, so it expected the path buffer to be free'd by the nfsvno_namei() when it hadn't set SAVENAME. It turns out ZFS sets SAVENAME in zfs_lookup() for the DELETE case. The attached patch, which is also here, should fix the problem for now: http://people.freebsd.org/~namei-leak.patch Please test this patch and let me know if it fixes the leak. jwd@ is working on a patch that will avoid using uma_zalloc() to get a path buffer for most cases for performance reasons. Once that patch goes it, the code should be patched so that it checks for SAVENAME being set for all cases where uma_zalloc() has allocated a path buffer, so that no more leaks like this will happen when underlying file systems set SAVENAME. rick ------=_Part_3402242_1883470986.1335389645646 Content-Type: text/x-patch; name=namei-leak.patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=namei-leak.patch LS0tIGZzL25mc3NlcnZlci9uZnNfbmZzZHBvcnQuYy5zYXYJMjAxMi0wNC0yNSAxNjo1MDowNS4w MDAwMDAwMDAgLTA0MDAKKysrIGZzL25mc3NlcnZlci9uZnNfbmZzZHBvcnQuYwkyMDEyLTA0LTI1 IDE3OjA4OjQzLjAwMDAwMDAwMCAtMDQwMApAQCAtMTA0Nyw2ICsxMDQ3LDggQEAgbmZzdm5vX3Jl bW92ZXN1YihzdHJ1Y3QgbmFtZWlkYXRhICpuZHAsIAogCWVsc2UKIAkJdnB1dChuZHAtPm5pX2R2 cCk7CiAJdnB1dCh2cCk7CisJaWYgKChuZHAtPm5pX2NuZC5jbl9mbGFncyAmIFNBVkVOQU1FKSAh PSAwKQorCQluZnN2bm9fcmVscGF0aGJ1ZihuZHApOwogCU5GU0VYSVRDT0RFKGVycm9yKTsKIAly ZXR1cm4gKGVycm9yKTsKIH0KQEAgLTEwODYsNiArMTA4OCw4IEBAIG91dDoKIAllbHNlCiAJCXZw dXQobmRwLT5uaV9kdnApOwogCXZwdXQodnApOworCWlmICgobmRwLT5uaV9jbmQuY25fZmxhZ3Mg JiBTQVZFTkFNRSkgIT0gMCkKKwkJbmZzdm5vX3JlbHBhdGhidWYobmRwKTsKIAlORlNFWElUQ09E RShlcnJvcik7CiAJcmV0dXJuIChlcnJvcik7CiB9Cg== ------=_Part_3402242_1883470986.1335389645646--