From nobody  Sun Mar  1 10:02:02 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id KAA10519;
          Sun, 1 Mar 1998 10:02:02 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199803011802.KAA10519@hub.freebsd.org>
Date: Sun, 1 Mar 1998 10:02:02 -0800 (PST)
From: remy@synx.com
To: freebsd-gnats-submit@freebsd.org
Subject: NFS server Side say NFSERR_BAD_COOKIE (rm -r fails)
X-Send-Pr-Version: www-1.0

>Number:         5890
>Category:       kern
>Synopsis:       NFS server Side say NFSERR_BAD_COOKIE (rm -r fails) [FIX ?]
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    peter
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar  1 10:29:42 PST 1998
>Closed-Date:    Sun Dec 12 00:04:33 PST 1999
>Last-Modified:  Sun Dec 12 00:05:34 PST 1999
>Originator:     Remy NONNENMACHER
>Release:        3.0-971225-SNAP
>Organization:
Synchronix
>Environment:
FreeBSD fs2.synx.com 3.0-971225-SNAP FreeBSD 3.0-971225-SNAP #4: Wed Feb 18 11:25:23 GMT 1998     root@fs2.synx.com:/usr/src/sys/compile/FS2  i386

>Description:
Client is a Solaris 2.5.1 client machine running NFS V3. Server is the FreeBSD.
The exported directory is a plain one (no cross-mount).
When the client do a rm -r of the directory, it gets a 'directory not empty' error.
I tcpdumped the flow and found the following operations :
Client : Stat directory
Server : stat is .... COOKIE=XXX
Client : (stat files in directory and remove files)
Server : (OK a each operation)
Client : rmdir COOKIE=XXX
Server : Error : Invalid COOKIE (NFSERR_BAD_COOKIE)

Files in directory are not removed and client get the 'dir not empty' error.
It seems that the problem doesn't appear on all directories but for ones
with many files.

PS: I'm not able to say if it's a Client or Server error. It may comes from the
way the cookie is generated (directory has changed) or a Solaris misuses of a cookie value.

>How-To-Repeat:
I can reproduce the problem and trace it on a specific directory. Don't know the
exact conditions. I can investigate if it may help.
>Fix:
By commented out the COOKIE test (sys/nfs/nfs_serv.c, v 1.52 1997/10/28 15:59:05 bde Exp)
line 2578 and 2833 and all went OK.
(I guessed the VOP_GETATTR was sufficient for consistency. (guessed only)).



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->peter 
Responsible-Changed-By: peter 
Responsible-Changed-When: Sat Apr 25 22:21:50 PDT 1998 
Responsible-Changed-Why:  
I'll take this one.. 

From: "David O'Brien" <motminh@NUXI.com>
To: freebsd-gnats-submit@freebsd.org, remy@synx.com
Cc:  Subject: Re: kern/5890: NFS server Side say NFSERR_BAD_COOKIE (rm -r fails) [FIX ?]
Date: Thu, 19 Nov 1998 22:12:33 -0800

 Hi Remy,
 
 Can you retest this bug?  Peter made many changes to sys/nfs/nfs_serv.c
 over the summer.  From the commit logs, I suspect it might be fixed.
 
 -- David (obrien@freebsd.org)
State-Changed-From-To: open->closed 
State-Changed-By: dillon 
State-Changed-When: Sun Dec 12 00:04:33 PST 1999 
State-Changed-Why:  
This has been fixed for -current (I'm not sure about -stable).  The 
NFSERR_BAD_COOKIE is actually a bug in solaris not following the spec 
completely, but FreeBSD was being too conservative in returning it and 
that has been fixed. 
>Unformatted:
