From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [patch 2/6] fs: no games with DCACHE_UNHASHED Date: Thu, 15 Oct 2009 09:44:35 +0200 Message-ID: <4AD6D2E3.9050105@gmail.com> References: <20091015044026.319860788@suse.de> <20091015050048.165912589@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , linux-fsdevel@vger.kernel.org, Ian Kent , Linus Torvalds , linux-kernel@vger.kernel.org, Miklos Szeredi To: npiggin@suse.de Return-path: Received: from gw1.cosmosbay.com ([212.99.114.194]:40182 "EHLO gw1.cosmosbay.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757869AbZJOHpW (ORCPT ); Thu, 15 Oct 2009 03:45:22 -0400 In-Reply-To: <20091015050048.165912589@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: npiggin@suse.de a =E9crit : > (this is in -mm) >=20 > Filesystems outside the regular namespace do not have to clear DCACHE= _UNHASHED > in order to have a working /proc/$pid/fd/XXX. Nothing in proc prevent= s the > fd link from being used if its dentry is not in the hash. >=20 > Also, it does not get put into the dcache hash if DCACHE_UNHASHED is = clear; > that depends on the filesystem calling d_add or d_rehash. >=20 > So delete the misleading comments and needless code. >=20 This was added in commit 304e61e6fbadec586dfe002b535f169a04248e49 [PATCH] net: don't insert socket dentries into dentry_hashtable =20 We currently insert socket dentries into the global dentry hashtabl= e. This is suboptimal because there is currently no way these entries can b= e used for a lookup(). (/proc/xxx/fd/xxx uses a different mechanism). In= serting them in dentry hashtable slows dcache lookups. =20 To let __dpath() still work correctly (ie not adding a " (deleted)"= ) after dentry name, we do : =20 - Right after d_alloc(), pretend they are hashed by clearing the DCACHE_UNHASHED bit. =20 - Call d_instantiate() instead of d_add() : dentry is not inserted = in hash table. =20 __dpath() & friends work as intended during dentry lifetime. =20 - At dismantle time, once dput() must clear the dentry, setting aga= in DCACHE_UNHASHED bit inside the custom d_delete() function provide= d by socket code, so that dput() can just kill_it. =20 Signed-off-by: Eric Dumazet Cc: Al Viro Acked-by: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Back in 2006, we had to perform this hack in order to not leak '(delete= d)' in __d_path() if (!IS_ROOT(dentry) && d_unhashed(dentry) && (prepend(&end, &buflen, " (deleted)", 10) !=3D 0))=20 goto Elong; In current kernel this part became : if (d_unlinked(dentry) && (prepend(&end, &buflen, " (deleted)", 10) !=3D 0)) goto Elong; So your cleanup seems good, thanks ! Acked-by: Eric Dumazet -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html