2004-08-13 07:04:40

by Per Buer

[permalink] [raw]
Subject: Does nfsd.o handle overwriting of files properly?

Hi.

We have a daemon which does the following. Create a new file "foo" and renames
this file to "bar". This happens on a nfs volume. The problem seems to be
that we get "stale NFS handle" right after "bar" is overwritten.

I guess the directory is cached and so the dentry points to an non-existing
inode (as the old "bar" is deleted when the ref-count hits zero).

Server: RHEL AS 2.1 (2.4.9 with lots and lots of pathes)
Client: RHEL ES 3.0 (2.4.21with lots and lots of pathes)

I fix could be to keep an link to the old "bar" hanging around for 30s or so -
but I consider that a somewhat dirty work-around.

Is there anything else I can do to mend this?

--
There are only 10 different kinds of people in the world,
those who understand binary, and those who don't.


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2004-08-13 16:06:35

by Trond Myklebust

[permalink] [raw]
Subject: Re: Does nfsd.o handle overwriting of files properly?

P=E5 fr , 13/08/2004 klokka 03:04, skreiv Per Buer:
> Hi.
>=20
> We have a daemon which does the following. Create a new file "foo" and re=
names=20
> this file to "bar". This happens on a nfs volume. The problem seems to be=
=20
> that we get "stale NFS handle" right after "bar" is overwritten.
>=20

That is fully expected behaviour for NFS. All implementations will do
the same thing, be it Solaris, Linux, IRIX,...

If you want the old file to be accessible, then the only workaround is
to rename it instead of deleting it (and that is precisely what most NFS
clients will do if you try to remove a file that is still held open by a
process on that client).

Cheers,
Trond


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs