Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 May 1997 16:24:03 +0000
From:      Kachun Lee <kachun@zippo.com>
To:        dfr@nlsystems.com (Doug Rabson)
Cc:        freebsd-stable@freebsd.org
Subject:   Re: can anyone confirm my NFS/VM problem?
Message-ID:  <3.0.1.32.19970520162403.007167ec@dopey.pathlink.com>

next in thread | raw e-mail | index | archive | help
> Well I think I have a fix.  It was bloody painful too.  There were some
> extremely ugly problems associated with NFS' use of b_validoff and
> b_validend.  I attempted to fix them but it still feels pretty fragile
> although it does pass Ghristoph's test case.

I am wondering if you would look into another problem related to NFS/MMAP.
Accessing a mmap NFS file when the file is deleted from the server will
result with following error:

 May 20 16:02:02 lacy /kernel: vnode_pager_getpages: I/O read error
 May 20 16:02:02 lacy /kernel: vm_fault: pager input (probably hardware)
error, P
 ID 522 failure

I applied the above patch to the lastest 22-releng and it did not fix this
problem. I wrote a simple C program to duplicate the problem. It will open
and mmap a file, read it, then wait for a key and read it again. So the
file can be deleted between keys. BTW, I normally need to wait for 5+
minutes after the file is deleted before I can see the error message.

Best regards

PS: The NFSV3 diroff memory leak is resolved... thanks again.

--------------------------------------------
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/uio.h>

#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>

main(int ac, char **av)
{
 int c;
 while(ac-- > 1)
 {
        ++av;

        int fdin = open(*av,  O_RDONLY);

        if(fdin < 0)
        {
                fprintf(stderr,"Cannot open %s\n", *av);
                continue;
        }

        struct stat sb;
        if(fstat(fdin, &sb) < 0)
        {
                fprintf(stderr,"Cannot stat %s\n", *av);
                close(fdin);
                continue;
        }

        char * pmap = mmap(0, sb.st_size, PROT_READ,
                MAP_SHARED, fdin, 0);
        if(((int)pmap) < 0)
        {
                perror("Cannot map file");
                close(fdin);
                continue;
        }

        for(c=0;c>=0;)
        {
                write(1, pmap, sb.st_size);
                while((c=getchar()) >= 0) if(c == '\n') break;

                extern int errno;
                if(fstat(fdin, &sb) < 0)
                        fprintf(stderr, "fstat error: %s\n",
                                strerror(errno));
        }
        close(fdin);
        munmap(pmap, sb.st_size);
 }
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.1.32.19970520162403.007167ec>