Hi,
I noticed that the system hung up right after the filesystem is full
by the memory mapped I/O (no terminal response and no one can enter
the KDB).
My environment is RedHat 7.1 + linux-2.4.10-pre10-xfs(20010918 XFS CVS Tree)
+ gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
The test program attached the end of this mail could reproduce this.
ex) filesystem capacity: 128MB
% cd /mnt/xfs
% testprog 40 /* 40 * 4MB = 160MB */
-> system hangs!
[Console Messages]
Unable to handle kernel paging request at virtual address cb7a868c
printing eip:
c012a351
*pde = 00000000
Unable to handle kernel paging request at virtual address 8109e000
printing eip:
c0208990
*pde = 00000000
In case of ext2fs, this program was killed by SIGBUS.
Is there anything to do for investigation?
P.S.
Why does disk block is allocated the reverse order by memory mapped I/O
as follows?
# mkfs -t xfs /dev/sda7
# mount /dev/sda7 /mnt/xfs
# cd /mnt/xfs
# testprog 1
# xfs_bmap hole
hole:
0: [0..7]: 8312..8319
1: [8..15]: 8304..8311
2: [16..23]: 8296..8303
3: [24..31]: 8288..8295
:
:
1021: [8168..8175]: 112..119
1022: [8176..8183]: 104..111
1023: [8184..8191]: 96..103
1024: [8192..4194295]: hole
1025: [4194296..4194303]: 8328..8335
%
[testprog.c]
--------8<--------8<--------8<--------8<--------8<--------8<--------
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define MAPSZ 4*1024*1024
int
main(int argc, char *argv[])
{
int fd;
int count;
off_t off = 0;
char *cp;
if (argc > 1)
count = atoi(argv[1]);
fd = open("hole", O_RDWR|O_CREAT|O_TRUNC, 0644);
if (fd < 0) {
perror("open(\"hole\")");
exit(1);
}
if (lseek(fd, 0x7fffffff-1, SEEK_SET) < 0) {
perror("lseek");
exit(1);
}
if (write(fd, "a", 1) < 0) {
perror("write");
exit(1);
}
if (lseek(fd, 0, SEEK_SET) < 0) {
perror("lseek");
exit(1);
}
while (count--) {
cp = mmap(0, MAPSZ, PROT_READ|PROT_WRITE, MAP_SHARED, fd, off);
if (cp == MAP_FAILED) {
perror("mmap");
exit(1);
}
memset(cp, '0', MAPSZ);
if (msync(cp, MAPSZ, MS_SYNC) < 0) {
perror("msync");
exit(1);
}
if (munmap(cp, MAPSZ) < 0) {
perror("munmap");
exit(1);
}
off += MAPSZ;
}
}
--------8<--------8<--------8<--------8<--------8<--------8<--------
--
ISHIZUKA Masayuki
|