linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* stale or not stale
@ 2012-08-03  1:57 Ed Goggin
  2012-08-03  2:29 ` Andrei Warkentin
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Goggin @ 2012-08-03  1:57 UTC (permalink / raw)
  To: linux-nfs


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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stale or not stale
  2012-08-03  1:57 stale or not stale Ed Goggin
@ 2012-08-03  2:29 ` Andrei Warkentin
  2012-08-03 10:52   ` Jeff Layton
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Warkentin @ 2012-08-03  2:29 UTC (permalink / raw)
  To: linux-nfs; +Cc: Ed Goggin

----- Original Message -----
> From: "Ed Goggin" <egoggin@vmware.com>
> To: linux-nfs@vger.kernel.org
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stale or not stale
  2012-08-03  2:29 ` Andrei Warkentin
@ 2012-08-03 10:52   ` Jeff Layton
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2012-08-03 10:52 UTC (permalink / raw)
  To: Andrei Warkentin; +Cc: linux-nfs, Ed Goggin

On Thu, 2 Aug 2012 19:29:14 -0700 (PDT)
Andrei Warkentin <awarkentin@vmware.com> wrote:

> ----- Original Message -----
> > From: "Ed Goggin" <egoggin@vmware.com>
> > To: linux-nfs@vger.kernel.org
> > 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.
> 

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.

-- 
Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-03 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03  1:57 stale or not stale Ed Goggin
2012-08-03  2:29 ` Andrei Warkentin
2012-08-03 10:52   ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).