Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 1997 20:14:52 +0900
From:      pine@math.okayama-u.ac.jp
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/3938: Problem about mmap() over NFS
Message-ID:  <199706231114.UAA17960@decpc5.math.okayama-u.ac.jp>
Resent-Message-ID: <199706231110.EAA28143@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3938
>Category:       kern
>Synopsis:       Problem about mmap() over NFS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 23 04:10:00 PDT 1997
>Last-Modified:
>Originator:     Hiroaki Komatsu
>Organization:
Okayama University
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

        NFS server: SPARC station 20 running SunOS 4.1.3
        NFS client: FreeBSD 2.2.2-RELEASE
                    FreeBSD 2.2.1-RELEASE
                    FreeBSD 2.1.0-RELEASE

>Description:

        An ftp command `get foo' between different NFS clients for
        a remote file `foo' of NFS causes ftpd to be frozen.

>How-To-Repeat:

        I think that the following program causes the same trouble,
        when an argument is a remote file of NFS, say `foo'.  While
        the program is sleeping 10 seconds, if another machine
        executes `echo >foo' then write() call can not return.

        ------------------------------------------------------------
        #include <stdio.h>
        #include <sys/mman.h>

        main(int argc, char *argv[])
        {
          FILE *fin;
          char *buf;

          if (argc != 2 || (fin = fopen(argv[1], "r")) == NULL) {
            fprintf(stderr, "Usage: %s file\n", argv[0]);
            exit(1);
          }

          fprintf(stderr, "sleep 10 seconds ...\n");
          sleep(10);

          buf = mmap(0, 1, PROT_READ, MAP_SHARED, fileno(fin), 0);
          if ((int)buf == -1) {
            fprintf(stderr, "? mmap\n");
            exit(1);
          }

          write(1, buf, 1);
        }

>Fix:
	
	
>Audit-Trail:
>Unformatted:



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