From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: Re: lifetime of DCACHE_DISCONECTED dentries Date: Mon, 29 Nov 2010 14:32:48 -0500 Message-ID: <20101129193248.GA9897@fieldses.org> References: <20101112184353.GA32745@fieldses.org> <20101115174837.GB10044@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Nick Piggin Return-path: Received: from fieldses.org ([174.143.236.118]:46645 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168Ab0K2Tct (ORCPT ); Mon, 29 Nov 2010 14:32:49 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Nov 29, 2010 at 02:56:22PM +1100, Nick Piggin wrote: > On Tue, Nov 16, 2010 at 5:45 PM, Nick Piggin wrot= e: > > On Tue, Nov 16, 2010 at 4:48 AM, J. Bruce Fields wrote: > >> On Sat, Nov 13, 2010 at 10:53:12PM +1100, Nick Piggin wrote: > >>> On Sat, Nov 13, 2010 at 5:43 AM, J. Bruce Fields wrote: > > > >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0- putfh: look up the filehandle. =C2= =A0The only alias found for the > >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode will be DCACHE_UNHASHED= alias referenced by the filp > >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0associated with the nfsd open= =2E =C2=A0d_obtain_alias() doesn't like > >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0this, so it creates a new DCA= CHE_DISCONECTED dentry and > >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0returns that instead. > >>> > >>> This seems to be where the thing goes wrong. It isn't a hashed de= ntry at > >>> this point here, so d_obtain_alias should not be making one. > >> > >> Sounds sensible. =C2=A0(But can you think of any actual bugs that = will result > >> from trying to add a new hashed dentry in this case?) > > > > Well, this one? :) > > > > > >>> I think the inode i_nlink games are much more appropriate on this= side of > >>> the equation, rather than the dput side (after all, d_obtain_alia= s is setting > >>> up an alias for the inode). > >>> > >>> Can you even put the link check into __d_find_alias? > >>> > >>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (S_ISDIR(in= ode->i_mode) || !d_unhashed(alias)) { > >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (S_ISDIR(in= ode->i_mode) || !inode->i_nlink || > >>> !d_unhashed(alias)) { > >>> > >>> Something like that? > >> > >> The immediate result of that would be for the close rpc (or any rp= c's > >> sent after the file was unlinked) to fail with ESTALE. > > > > Why is that? Seems like it would be a bug, because a hashed dentry = may > > be unhashed at any time concurrently to nfsd operation, so it shoul= d be > > able to tolerate that so long as it has a ref on the inode? >=20 > Ping? Did you work out why nfs fails with ESTALE in that case? It see= ms > to work in my testing (and do the right thing with freeing the inode)= =2E Bah, sorry, I read too quickly, got the sense of the test backwards, an= d thought you were suggesting __d_find_alias() shouldn't return an alias in the i_nlink =3D=3D 0 case! Yes, agreed, that should solve my problem. But what's the reason for the d_unhashed() check now? Could we get rid of it entirely? --b. -- 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