home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!walter!porthos!pyuxd!esg
- From: esg@pyuxd.uucp (25235-gokhman)
- Subject: Re: /tmp Corrupted
- Organization: Bellcore, Livingston, NJ
- Date: Thu, 19 Nov 92 17:15:25 GMT
- Message-ID: <1992Nov19.171525.16507@porthos.cc.bellcore.com>
- Summary: Programming example of an AIX 3.2 bug related to this problem
- References: <1992Nov5.225824.3656@netcom.com> <1992Nov18.161444.97310@slate.mines.colorado.edu>
- Sender: netnews@porthos.cc.bellcore.com (USENET System Software)
- Lines: 55
-
- In addition to several examples illustrating the typical reason for
- this situation to occur: running processes unlinking but not closing
- the files, similar simptoms may occur due to the NFS-related bug
- in AIX 3.2. This bug may explain some of the "war stories",
- when the misterious loss of space could not be tracked to _running_ processes.
- Unfortunately, /tmp is rarely remote, so there are more problems
- out there to be explained...
-
- We found that the AIX 3.2 RS6000 implementation of the flock subroutine
- is faulty when applied to files mounted accross NFS and causes a remote
- filesystem to run out of space.
-
- If a file A is locked and a file B is renamed into A,
- the inodes of the old A are not properly reclaimed
- if A and B are mounted over NFS. This problem causes
- the remote file system to run out of space, e.g. use df command,
- while the du and ls -l commands do not show any changes.
- The same scenario works fine for local files.
-
- Following example will quickly run the remote filesystem out of
- space, while causing no damage if ran locally.
-
- Ed Gokhman, (908) 699-4785
- esg@pyuxd.cc.bellcore.com
-
-
-
- # include <stdio.h>
- # include <fcntl.h>
- # include <sys/file.h>
- # include <errno.h>
-
- # define ONE_MEG 1000000
-
- main ()
- {
- for (;;)
- {
- int try1, try2;
- char one_meg [ONE_MEG];
-
- if (
- (try2 = open ("try2", O_RDWR | O_CREAT, 0664)) == -1 ||
- flock (try2, LOCK_EX) == -1 ||
- (try1 = open ("try1", O_RDWR | O_CREAT, 0664)) == -1 ||
- write (try1, one_meg, ONE_MEG) == -1 ||
- close (try1) == -1 ||
- rename ("try1", "try2") == -1 ||
- close (try2) == -1
- )
-
- { fprintf (stderr, "Problems...%s\n", strerror(errno)); exit (1); }
- }
- }
-
-