Subject: port-i386/500: file system space is lost
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: netbsd-bugs
Date: 09/28/1994 16:05:03
>Number:         500
>Category:       port-i386
>Synopsis:       file system space is lost
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 28 16:05:02 1994
>Originator:     Lennart Augustsson
>Organization:
"Chalmers Univ. of Tech"
>Release:        
>Environment:
	
System: NetBSD marvin.cs.chalmers.se 1.0_BETA NetBSD 1.0_BETA (MARVIN) #409: Thu Sep 8 11:21:23 MET DST 1994 augustss@marvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/MARVIN i386


>Description:
	When the program below is run 1M of file system space is
	lost, despite the created file being unlink()ed.
>How-To-Repeat:
	compile the program below, do a 'df .', run it, and do 'df .' again.
	1M less, *sigh*

------
#include <sys/types.h>
#include <sys/mman.h>
char b[1024];
main()
{
	int fd;
	int i;
	void *p;

	fd = creat("foo", 0666);
	for(i = 0; i < 1024; i++)
		write(fd, b, 1024);
	close(fd);
	fd = open("foo", 0);
	unlink("foo");
	p = mmap(0, 1024*1024, PROT_READ, 0, fd, 0);
	if (p == -1) perror("mmap");
	munmap(p, 1024*1024);
	close(fd);
}
------
>Fix:
	Dunno
>Audit-Trail:
>Unformatted: