tmpfs sparse file failure in glibc "make check"

From: Kevin P. Fleming
Date: Thu Jan 29 2004 - 22:38:44 EST


I've been tracking down a problem in CVS glibc "make check" and it appears that either it's a bug in tmpfs or an undocumented limitation of tmpfs.

My system is running 2.6.2-rc2, with 1G of physical RAM (4G highmem mode is enabled in the kernel). The glibc test does the following (snipped from the source because it's a simple test):

int fd;
#define TWO_GB 2147483648LL

...

fd = mkstemp64 (name);
ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
ret = write (fd, "Hello", 5);


On my system the temp file is created in /tmp, and tmpfs is mounted on /tmp (with no mount options limiting maximum size or anything of that type). With no swap space turned on, this write() returns ENOMEM.

With 512MB or 1GB of swap space, it still returns ENOMEM. With 1.5GB of swap space, the write() succeeds. However, this is a sparse file with a total of 6 bytes of content :-)

I could understand if tmpfs was limiting the file size to half of physical RAM+swap, but the test succeeds at 2.5GB total even though the sparse file is created at 2GB size.

For now I work around the test failure by pointing glibc to a different filesystem for this test, but I'm wondering why the tmpfs filesystem can't pass this test like a "normal" filesystem does...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/