Subject: Re: ufs-ism in lookup(9)
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/22/2004 10:55:22
--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sat, Mar 20, 2004 at 12:37:13PM +0100, Jaromir Dolecek wrote:
> Martin Husemann wrote:
> > On Sat, Mar 20, 2004 at 08:34:27AM +0100, Jaromir Dolecek wrote:
> > > You surely need to do lookup before deleting a file - you are
> > > supposed to return ENOENT if it doesn't exist.
> >=20
> > While that's true for local file systems, the suggested optimizations
> > certainly sounds right for remote file systems to me.
>=20
> Well, it's change of semantics - if we want to consistently
> return ENOENT, we need to check if the file was not removed
> on remove fileserver, thus we cannot use our local cache.
> =20
> Also, AFAICS the non-cached lookup might be necessary so that
> we'd ignore any negative cache entry we might have, so that
> following steps would really remove the file:
>=20
> 1. do local lookup (ls 'file')
> 2. some other client creates 'file'
> 3. rm 'file'
>=20
> Though NFS code might actually check if the entry returned
> by cache_lookup() is still valid, so the negative cache entry
> would be ignored nevertheless.
We'd need to change the nami cache interface some for this. AFAICT=20
cache_lookup() doesn't actually return the cache entry, it just returns=20
ENOENT. To do what you're suggesting (which I think is good), we'd need to=
=20
add a way for a file system to hang data off of the cache entry, so that=20
nfs can time out the entry.
As a simpler step, we could just adjust cache_lookup() so that it only=20
uses the negative cache entry for LOOKUPs, not !=3D CREATE. As long as=20
rename and delete ops have MAKEENTRY off and we remove the entry if=20
MAKEENTRY isn't there, we never hit this code path, so the two conditions=
=20
(=3D=3D LOOKUP, !=3D CREATE) are the same.
Take care,
Bill
--OXfL5xGRrasGEqWY
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFAXzaaWz+3JHUci9cRAg88AJwJtWg/bd2eC03Q5skxMzzlIwKuxACfUmkF
xoHs2M90QHsw8MFTiJyZEt8=
=ZhSE
-----END PGP SIGNATURE-----
--OXfL5xGRrasGEqWY--