From nobody@FreeBSD.org  Wed Jan 12 06:29:39 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E88D216A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Jan 2005 06:29:39 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CF84843D53
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Jan 2005 06:29:39 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j0C6TdXG014894
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Jan 2005 06:29:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0C6TdlG014893;
	Wed, 12 Jan 2005 06:29:39 GMT
	(envelope-from nobody)
Message-Id: <200501120629.j0C6TdlG014893@www.freebsd.org>
Date: Wed, 12 Jan 2005 06:29:39 GMT
From: Michael Conlen <meconlen@obfuscated.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: FreeBSD 4.11 client will send a NFS request to rename a file to itself to the NFS server, no error returned
X-Send-Pr-Version: www-2.3

>Number:         76126
>Category:       kern
>Synopsis:       [nfs] [patch] 4.11 client will send a NFS request to rename a file to itself to the NFS server, no error returned
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 12 06:30:37 GMT 2005
>Closed-Date:    
>Last-Modified:  Sun Oct 23 23:24:37 GMT 2005
>Originator:     Michael Conlen
>Release:        FreeBSD 4.11-STABLE client FreeBSD 5.3-p3 Server
>Organization:
Obfuscated Networking
>Environment:
FreeBSD web10.tarhost.com 4.11-STABLE FreeBSD 4.11-STABLE #2: Mon Jan  3 19:30:17 EST 2005     root@web10.tarhost.com:/usr/obj/usr/src/sys/WWW  i386

>Description:
A FreeBSD 4.11 client keeps sending requests to move a file to the same file name. The server complains but there's no error on the client to say hey! bad software! bad!
>How-To-Repeat:
on an NFS mounted filesystem 

$ echo foo > foo
$ mv foo foo
$ echo $?
0
$
>Fix:
The following patch should work

$ diff -u `pwd`/nfs_vnops.c.orig `pwd`/nfs_vnops.c
--- /usr/src/sys/nfs/nfs_vnops.c.orig   Wed Jan 12 00:15:42 2005
+++ /usr/src/sys/nfs/nfs_vnops.c        Wed Jan 12 01:00:41 2005
@@ -1647,6 +1647,12 @@
                goto out;
        }
 
+       if (fvp == tvf) {
+               printf("nfs_rename: fvp == tvp (can't happen)\n");
+               error = 0;
+               goto out;
+       }
+
        /*
         * We have to flush B_DELWRI data prior to renaming
         * the file.  If we don't, the delayed-write buffers
      
>Release-Note:
>Audit-Trail:

From: Michael E.Conlen <meconlen@obfuscated.net>
To: Michael E Conlen <meconlen@obfuscated.net>,
	freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/76126: FreeBSD 4.11 client will send a NFS request to rename a file to itself to the NFS server, no error returned
Date: Wed, 12 Jan 2005 15:38:09 -0500

 After additional testing it seems that the above code I submitted will 
 catch the problem on the client and not pass it on to the NFS server, 
 but obviously it shouldn't even get down that far.
 
 I'm continuing to test what's going on, but you know the patch, 
 compile, reboot cycle...
 
>Unformatted:
