NetBSD Problem Report #500

From gnats  Wed Sep 28 15:57:42 1994
Received: from animal.cs.chalmers.se (root@animal.cs.chalmers.se [129.16.225.30]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id PAA12316 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 28 Sep 1994 15:57:40 -0700
Message-Id: <199409282259.XAA13610@animal.cs.chalmers.se>
Date: Wed, 28 Sep 1994 23:59:10 +0100
From: Lennart Augustsson <augustss@cs.chalmers.se>
Reply-To: augustss@cs.chalmers.se
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: file system space is lost
X-Send-Pr-Version: 3.2

>Number:         500
>Category:       kern
>Synopsis:       file system space is lost
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 28 16:05:02 +0000 1994
>Closed-Date:    Fri Feb 20 01:07:07 +0000 1998
>Last-Modified:  Fri Feb 20 01:07:28 +0000 1998
>Originator:     Lennart Augustsson
>Release:        
>Organization:
"Chalmers Univ. of Tech"
>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);
}
------

	This is because the VM object backing the file is not immediately deleted,
	and therefore the file is not reclaimed by the file system.  When the vnode
	is eventually reclaimed, the space will be regained.  Although this was
	reported specifically on the i386 port, it is a more generic VM system
	problem.  - mycroft

>Fix:
	Dunno
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mrg 
State-Changed-When: Thu Feb 19 17:07:07 PST 1998 
State-Changed-Why:  
this is fixed under UVM. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.