From nobody@FreeBSD.ORG Tue Oct 12 06:15:11 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 4F78415B1E; Tue, 12 Oct 1999 06:14:58 -0700 (PDT)
Message-Id: <19991012131458.4F78415B1E@hub.freebsd.org>
Date: Tue, 12 Oct 1999 06:14:58 -0700 (PDT)
From: amobbs@allstor-sw.co.uk
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: NFS client appears to lose data
X-Send-Pr-Version: www-1.0

>Number:         14285
>Category:       kern
>Synopsis:       NFS client appears to lose data
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 12 06:20:00 PDT 1999
>Closed-Date:    Sat Nov 15 13:56:47 PST 2003
>Last-Modified:  Sat Nov 15 13:56:47 PST 2003
>Originator:     Andrew Mobbs
>Release:        3.3-RC
>Organization:
Allstor Software
>Environment:
FreeBSD symbiosis.software.plasmon 3.3-RC FreeBSD 3.3-RC #0: Tue Sep 14 11:39:37 BST 1999     root@symbiosis.software.plasmon:/usr/src/sys/compile/990820symbiosis  i386
>Description:
As far as I can tell, the following program will lose data on a
FreeBSD->FreeBSD NFS mount, but not on a
FreeBSD->{Solaris,Linux,AIX} or a {Solaris,Linux}->FreeBSD mount
(Notation is server->client)
All mounts are hard. NFS options are whatever the default on a given 
platform is.
Network is 100MBps switched ethernet.

The output file "testfile" loses occasional characters
OS versions:
Solaris 2.5.1 (sparc)
Linux 2.2.10 (i386)
FreeBSD 3.3-RC (client) (i386)
FreeBSD 3.2-R  (server) (i386)
AIX 4.2 (rs6000)

>How-To-Repeat:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <sys/types.h>

main(void){

        int error=0,len,i;
        FILE *fp;
        pid_t mypid;
        char str[80];

        init_mutex(&mutex);

        srandom(time(NULL));

        mypid=getpid();

        sprintf(str,"Hello, I'm process %d.\n",mypid);
        len=strlen(str);

        if((fp=fopen("testfile","a+"))==NULL){
                fprintf(stderr,"Cannot open testfile failed %d\n",errno);
                exit(1);
        }

        for(;;){
                for(i=0;i<len;i++){
                        fputc(str[i],fp);
                        usleep((random()%1000)*100);
                        fflush(fp);
                }
        }
}

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dillon 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Oct 12 06:53:16 PDT 1999 
Responsible-Changed-Why:  
Over to Mr NFS. :-) 
Responsible-Changed-From-To: dillon->freebsd-bugs 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Sat Feb 22 18:13:56 PST 2003 
Responsible-Changed-Why:  
Back to the free pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=14285 
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Sat Nov 15 13:55:36 PST 2003 
State-Changed-Why:  
I am unable to reproduce this.  Your code does not compile 
as it stands because of "init_mutex(&mutex);", which suggests 
it was originally written as a multi-threaded program.  Removing 
this call, I do not experience any unexpected results on a 4.x NFS 
server.  Either the bug has been fixed, or your problem was actually 
a threading bug in your test code. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=14285 
>Unformatted:
