Date: Sun, 12 Mar 1995 21:23:32 -0600 (CST) From: Jim Bryant <jbryant@server.iadfw.net> To: freebsd-hackers@FreeBSD.org Subject: Re: rename bug Message-ID: <199503130323.VAA05484@news.iadfw.net> In-Reply-To: <199503130243.CAA02794@bagpuss.demon.co.uk> from "Karl Strickland" at Mar 13, 95 02:43:16 am
next in thread | previous in thread | raw e-mail | index | archive | help
In reply:
> From: Karl Strickland <karl@bagpuss.demon.co.uk>
> Subject: Re: rename bug
> Date: Mon, 13 Mar 1995 02:43:16 +0000 (GMT)
>
> >
> > In reply:
> > > From: Karl Strickland <karl@bagpuss.demon.co.uk>
> > > Subject: Re: rename bug
> > > Date: Mon, 13 Mar 1995 02:15:48 +0000 (GMT)
> > >
> > > >
> > > > We first noticed that the rename(2) call has a serious bug when we ran
> > > > out of space on our root partition during a passwd rebuild when adding
> > > > users in several sittings. This of course required me to drive 60 miles
> > > > to bring the system back up...
> > >
> > > what is the bug?
> >
> > The bug is when a rename(2) is called, the rename happens as per spec,
> > except that the kernel isn't being updated as to the available space on
> > the filesystem. A reboot is needed to recognize the space is available.
> >
> > For instance every time we add a user, our root filesystem APPEARS to
> > have lost 1508k, this is caused when pwd_mkdb renames pwd.db.tmp to
> > pwd.db, and spwd.db.tmp to spwd.db.
> >
> > I can duplicate this in several ways on both our server and my personal
> > machine. I do not think that hardware compat is an issue, as the two
> > machines are as different as night and day. mv(1) also will duplicate
> > the bug.
> >
> > I am confident that it is in the rename(2) system call.
> >
> > Jim
>
> thanks for the info - im a little confused though
>
> can you show me a script(1) of the bug occuring?
Sure [Edited to remove escape codes, cursor positioning, and typo repair]:
Script started on Sun Mar 12 20:59:21 1995
8:59:22pm EndersBox(1): tail -51 pwd_mkdb.c | head -13
void
mv(from, to)
char *from, *to;
{
char buf[MAXPATHLEN];
if (rename(from, to)) {
int sverrno = errno;
(void)snprintf(buf, sizeof(buf), "%s to %s", from, to);
errno = sverrno;
error(buf);
}
}
8:59:44pm EndersBox(2): ls -lag
total 248
drwxrwxrwt 2 bin bin 512 Mar 12 20:59 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 369 Mar 12 20:59 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11553 Mar 12 20:58 pwd_mkdb.c
8:59:52pm EndersBox(3): make
cc -O2 -m486 -fomit-frame-pointer -pipe -c pw_scan.c
cc -O2 -m486 -fomit-frame-pointer -pipe -c pwd_mkdb.c
cc -O2 -m486 -fomit-frame-pointer -pipe -o pwd_mkdb pw_scan.o pwd_mkdb.o
DING! EndersBox(4): pwd_mkdb -d /tmp master.passwd
9:00:36pm EndersBox(5): ls -lag
total 1582
drwxrwxrwt 2 bin bin 512 Mar 12 21:00 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 1218 Mar 12 21:00 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:00 pwd.db
-rwxr-xr-x 1 root bin 13109 Mar 12 21:00 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11553 Mar 12 20:58 pwd_mkdb.c
-rw-r--r-- 1 root bin 5637 Mar 12 21:00 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:00 spwd.db
9:00:40pm EndersBox(6): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 1581 44793 3% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:00:43pm EndersBox(7): pwd_mkdb -d /tmp master.passwd
9:01:11pm EndersBox(8): ls -lag
total 1583
drwxrwxrwt 2 bin bin 512 Mar 12 21:01 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 2567 Mar 12 21:01 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:01 pwd.db
-rwxr-xr-x 1 root bin 13109 Mar 12 21:00 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11553 Mar 12 20:58 pwd_mkdb.c
-rw-r--r-- 1 root bin 5637 Mar 12 21:00 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:01 spwd.db
9:01:18pm EndersBox(9): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 2894 43480 6% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:01:20pm EndersBox(10): exit
Script done on Sun Mar 12 21:01:37 1995
Script started on Sun Mar 12 21:02:51 1995
9:02:51pm EndersBox(1): tail -53 pwd_mkdb.c | head 15
head: 15: No such file or directory
9:03:14pm EndersBox(2): tail -53 pwd_mkdb.c | head -15
void
mv(from, to)
char *from, *to;
{
/*
char buf[MAXPATHLEN];
if (rename(from, to)) {
int sverrno = errno;
(void)snprintf(buf, sizeof(buf), "%s to %s", from, to);
errno = sverrno;
error(buf);
}
*/
}
9:03:32pm EndersBox(3): make
cc -O2 -m486 -fomit-frame-pointer -pipe -c pwd_mkdb.c
cc -O2 -m486 -fomit-frame-pointer -pipe -o pwd_mkdb pw_scan.o pwd_mkdb.o
9:03:47pm EndersBox(4): ls -lag
total 1585
drwxrwxrwt 2 bin bin 512 Mar 12 21:03 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 4634 Mar 12 21:03 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:01 pwd.db
-rwxr-xr-x 1 root bin 13109 Mar 12 21:03 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11559 Mar 12 21:02 pwd_mkdb.c
-rw-r--r-- 1 root bin 5497 Mar 12 21:03 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:01 spwd.db
9:03:54pm EndersBox(5): pwd_mkdb -d /tmp master.passwd
9:04:27pm EndersBox(6): ls -lag
total 2898
drwxrwxrwt 2 bin bin 512 Mar 12 21:04 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 5569 Mar 12 21:04 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:01 pwd.db
-rw-r--r-- 1 root bin 688128 Mar 12 21:04 pwd.db.tmp
-rwxr-xr-x 1 root bin 13109 Mar 12 21:03 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11559 Mar 12 21:02 pwd_mkdb.c
-rw-r--r-- 1 root bin 5497 Mar 12 21:03 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:01 spwd.db
-rw------- 1 root bin 716800 Mar 12 21:04 spwd.db.tmp
9:04:30pm EndersBox(7): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 4209 42165 9% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:04:34pm EndersBox(8): mv pwd.db.tmp pwd.db ; mv spwd.db.tmp spwd.db
9:04:54pm EndersBox(9): ls -lag
total 1587
drwxrwxrwt 2 bin bin 512 Mar 12 21:05 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 7043 Mar 12 21:05 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:04 pwd.db
-rwxr-xr-x 1 root bin 13109 Mar 12 21:03 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11559 Mar 12 21:02 pwd_mkdb.c
-rw-r--r-- 1 root bin 5497 Mar 12 21:03 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:04 spwd.db
9:05:00pm EndersBox(10): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 4210 42164 9% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:05:01pm EndersBox(11): pwd_mkdb -d /tmp master.passwd
9:05:30pm EndersBox(12): ls -lag
total 2901
drwxrwxrwt 2 bin bin 512 Mar 12 21:05 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 8442 Mar 12 21:05 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:04 pwd.db
-rw-r--r-- 1 root bin 688128 Mar 12 21:05 pwd.db.tmp
-rwxr-xr-x 1 root bin 13109 Mar 12 21:03 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11559 Mar 12 21:02 pwd_mkdb.c
-rw-r--r-- 1 root bin 5497 Mar 12 21:03 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:04 spwd.db
-rw------- 1 root bin 716800 Mar 12 21:05 spwd.db.tmp
9:05:37pm EndersBox(13): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 5525 40849 12% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:06:22pm EndersBox(14): cp pwd.db.tmp pwd.db ; rm pwd.db.tmp
9:06:40pm EndersBox(15): cp spwd.db.tmp spwd.db ; rm spwd.db.tmp
9:06:53pm EndersBox(16): ls -lag
total 1671
drwxrwxrwt 2 bin bin 512 Mar 12 21:06 .
drwxr-xr-x 15 root Gawd 512 Mar 4 02:04 ..
-rw-r--r-- 1 root bin 121 Mar 12 17:47 Makefile
-rw-r--r-- 1 root bin 10252 Mar 12 21:06 mailing
-rw------- 1 root Gawd 122482 Mar 12 17:50 master.passwd
-rw-r--r-- 1 root Gawd 94142 Mar 12 17:50 passwd
-rw-r--r-- 1 root bin 4180 Mar 12 17:47 pw_scan.c
-rw-r--r-- 1 root bin 1920 Mar 12 17:47 pw_scan.h
-rw-r--r-- 1 root bin 1479 Mar 12 21:00 pw_scan.o
-rw-r--r-- 1 root bin 688128 Mar 12 21:06 pwd.db
-rwxr-xr-x 1 root bin 13109 Mar 12 21:03 pwd_mkdb
-rw-r--r-- 1 root bin 4303 Mar 12 17:47 pwd_mkdb.8
-rw-r--r-- 1 root bin 11559 Mar 12 21:02 pwd_mkdb.c
-rw-r--r-- 1 root bin 5497 Mar 12 21:03 pwd_mkdb.o
-rw------- 1 root bin 716800 Mar 12 21:06 spwd.db
9:06:56pm EndersBox(17): df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0a 49231 23923 22846 51% /
/dev/wd0f 48815 4294 42080 9% /tmp
/dev/wd0e 895327 458322 392238 54% /usr
/dev/wd1a 395871 142150 233927 38% /.1
procfs 4 4 0 100% /proc
9:07:00pm EndersBox(18): exit
Script done on Sun Mar 12 21:07:07 1995
Jim
--
All opinions expressed are mine, if you | "I will not be pushed, stamped,
think otherwise, then go jump into turbid | briefed, debriefed, indexed, or
radioactive waters and yell WAHOO !!! | numbered!" - #1, "The Prisoner"
jbryant@server.iadfw.net, System administrator, Internet America
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503130323.VAA05484>
