Re: [PATCH] NR_RESERVED_FILES broken in 2.4 too

From: Tigran Aivazian (tigran@veritas.com)
Date: Sun Dec 10 2000 - 11:53:24 EST


Hi,

> user% ./fd-exhaustion # e.g. while(1) open("/dev/null",...);
> root# cat /proc/sys/fs/file-nr
> cat: /proc/sys/fs/file-nr: Too many open files in system
>
> The above happens even with increased NR_RESERVED_FILES to 96 [no
> wonder, get_empty_filp is broken].

no, it is not broken. But your experiment is broken. Don't do cat file-nr
but compile this C program
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
        int fd, len;
        static char buf[2048];

        fd = open("/proc/sys/fs/file-nr", O_RDONLY);
        if (fd == -1) {
                perror("open");
                exit(1);
        }
        while (1) {
                len = read(fd, buf, 1024);
                printf("len=%d %s", len, buf);
                lseek(fd, 0, SEEK_SET);
                sleep(1);
        }
        return 0;
}

and leave it running while doing experiments on the other console. You
will see that everything is fine -- there is no bug. No wonder you saw the
bug -- you ignored my 4 emails telling you otherwise :)

Regards,
Tigran

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



This archive was generated by hypermail 2b29 : Fri Dec 15 2000 - 21:00:19 EST