Skip to contentSkip to conversation

stale or not stale

DISCUSSION Ed Goggin 3 participants 3 messages Aug 3, 2012

Subsystems (2)
lore
Share & tools
lore

Ed Goggin

author
#0 lore raw

It seems that nfsd can return reply attributes with a link count of zero but without an NFS3ERR_STALE status. We've seen this actually happen for a write request to a file with a single link that is concurrently being removed without NLM lock protection. What is the proper behavior here?

#1 lore raw

----- Original Message -----

Quoted 11 lines

From: "Ed Goggin" <[email protected]>
To: [email protected]
Sent: Thursday, August 2, 2012 9:57:58 PM
Subject: stale or not stale

It seems that nfsd can return reply attributes with a link count of zero but without an NFS3ERR_STALE status. We've seen this actually happen for a write request to a file with a single link that is concurrently being removed without NLM lock protection. What is the proper behavior here?

I think it would be worthwhile to add here that the the remove was not concurrent with the write, and at the time of the NFS write a new file with the same name existed, yet fh decoding picked up the old inode instead of reporting -ESTALE. FS was ext4.

In fact seen two things happen - n_link = 0 and n_link = 1, and in both cases we knew the file was unlink()ed and re-creat()ed.

A

#2 lore raw
Quoted 13 lines · On Thu, 2 Aug 2012 19:29:14 -0700 (PDT) Andrei Warkentin…

----- Original Message -----

Quoted 11 lines

From: "Ed Goggin" <[email protected]>
To: [email protected]
Sent: Thursday, August 2, 2012 9:57:58 PM
Subject: stale or not stale

It seems that nfsd can return reply attributes with a link count of zero but without an NFS3ERR_STALE status. We've seen this actually happen for a write request to a file with a single link that is concurrently being removed without NLM lock protection. What is the proper behavior here?

Quoted 4 lines

I think it would be worthwhile to add here that the the remove was not concurrent with the write, and at the time of the NFS write a new file with the same name existed, yet fh decoding picked up the old inode instead of reporting -ESTALE. FS was ext4.

In fact seen two things happen - n_link = 0 and n_link = 1, and in both cases we knew the file was unlink()ed and re-creat()ed.

That's entirely valid behavior.

ESTALE from the server is its way of saying: "I don't recognize that filehandle". It can't figure out how to match that filehandle to an inode.

An i_nlink count of 0 means that there are no more hardlinks attached to the inode. It's deleted from the namespace, but the inode still exists until there are no more i_count references held on it.

Signature · 1 line
Jeff Layton <[email protected]>