Eric Dumazet
518de9b39e
fs: allow for more than 2^31 files
...
Robin Holt tried to boot a 16TB system and found af_unix was overflowing
a 32bit value :
<quote>
We were seeing a failure which prevented boot. The kernel was incapable
of creating either a named pipe or unix domain socket. This comes down
to a common kernel function called unix_create1() which does:
atomic_inc(&unix_nr_socks);
if (atomic_read(&unix_nr_socks) > 2 * get_max_files())
goto out;
The function get_max_files() is a simple return of files_stat.max_files.
files_stat.max_files is a signed integer and is computed in
fs/file_table.c's files_init().
n = (mempages * (PAGE_SIZE / 1024)) / 10;
files_stat.max_files = n;
In our case, mempages (total_ram_pages) is approx 3,758,096,384
(0xe0000000). That leaves max_files at approximately 1,503,238,553.
This causes 2 * get_max_files() to integer overflow.
</quote>
Fix is to let /proc/sys/fs/file-nr & /proc/sys/fs/file-max use long
integers, and change af_unix to use an atomic_long_t instead of atomic_t.
get_max_files() is changed to return an unsigned long. get_nr_files() is
changed to return a long.
unix_nr_socks is changed from atomic_t to atomic_long_t, while not
strictly needed to address Robin problem.
Before patch (on a 64bit kernel) :
# echo 2147483648 >/proc/sys/fs/file-max
# cat /proc/sys/fs/file-max
-18446744071562067968
After patch:
# echo 2147483648 >/proc/sys/fs/file-max
# cat /proc/sys/fs/file-max
2147483648
# cat /proc/sys/fs/file-nr
704 0 2147483648
Reported-by: Robin Holt <holt@sgi.com >
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com >
Acked-by: David Miller <davem@davemloft.net >
Reviewed-by: Robin Holt <holt@sgi.com >
Tested-by: Robin Holt <holt@sgi.com >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Christoph Hellwig <hch@lst.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2010-10-26 16:52:15 -07:00
..
2010-10-21 16:42:32 -07:00
2010-10-18 15:16:08 +02:00
2010-10-20 15:38:23 -07:00
2010-10-20 15:37:28 -07:00
2010-10-26 16:52:14 -07:00
2010-10-13 07:49:27 -07:00
2010-09-19 12:12:28 +01:00
2010-08-24 14:57:09 -07:00
2010-10-12 12:44:51 -03:00
2010-10-23 11:47:02 -07:00
2010-10-13 18:00:51 +02:00
2010-10-18 11:22:05 +02:00
2010-10-13 18:00:51 +02:00
2010-10-13 18:00:51 +02:00
2010-10-06 19:39:31 -07:00
2010-10-26 09:55:25 -07:00
2010-10-22 20:30:48 -07:00
2010-10-15 21:18:59 +02:00
2010-10-22 10:20:08 -07:00
2010-10-21 20:21:03 -04:00
2010-09-23 14:33:39 -07:00
2010-10-26 16:52:10 -07:00
2010-10-25 04:54:25 -04:00
2010-10-21 10:32:29 +02:00
2010-10-09 21:51:45 +02:00
2010-10-22 17:07:18 -07:00
2010-10-24 22:06:02 +02:00
2010-09-10 12:35:40 +02:00
2010-10-07 09:43:11 +02:00
2010-10-25 08:02:40 -07:00
2010-10-25 08:02:40 -07:00
2010-10-25 08:02:40 -07:00
2010-09-14 16:08:45 -07:00
2010-10-14 14:32:06 -07:00
2010-09-30 21:19:22 -04:00
2010-09-24 07:40:30 -07:00
2010-09-21 12:14:25 +02:00
2010-10-22 10:16:43 -07:00
2010-09-07 14:17:10 -05:00
2010-09-22 17:22:38 -07:00
2010-09-22 15:29:32 -07:00
2010-10-21 14:23:48 -07:00
2010-10-14 18:38:42 +02:00
2010-10-14 18:38:20 +02:00
2010-10-15 14:06:53 +02:00
2010-10-22 17:03:12 -07:00
2010-10-21 14:47:59 +02:00
2010-10-24 22:06:02 +02:00
2010-09-23 14:33:39 -07:00
2010-10-21 01:26:54 -07:00
2010-10-23 09:24:34 +09:00
2010-08-27 19:54:09 -04:00
2010-10-18 11:03:14 +02:00
2010-10-26 16:52:15 -07:00
2010-10-22 10:22:17 -07:00
2010-09-09 20:46:30 +02:00
2010-09-14 00:23:59 -07:00
2010-10-24 22:06:02 +02:00
2010-10-26 16:52:10 -07:00
2010-10-25 14:11:37 -07:00
2010-09-01 08:55:24 -06:00
2010-10-21 14:37:27 -07:00
2010-10-23 22:49:32 +02:00
2010-09-24 14:03:44 +02:00
2010-10-26 16:52:08 -07:00
2010-10-12 16:53:37 +02:00
2010-10-08 09:32:46 +02:00
2010-10-24 18:16:57 +02:00
2010-10-24 13:41:39 -07:00
2010-10-11 15:04:21 -04:00
2010-10-05 20:26:58 -07:00
2010-10-18 11:03:14 +02:00
2010-09-21 18:04:47 -07:00
2010-10-21 19:59:31 -07:00
2010-08-29 21:57:55 -07:00
2010-10-21 16:08:28 +02:00
2010-09-30 21:16:05 -07:00
2010-10-22 10:21:26 -07:00
2010-10-25 07:59:01 -07:00
2010-09-07 11:16:43 +01:00
2010-10-23 08:25:36 -07:00
2010-10-26 16:52:08 -07:00
2010-10-04 22:45:24 +09:00
2010-10-21 16:08:28 +02:00
2010-10-18 19:58:50 +02:00
2010-10-12 16:53:44 +02:00
2010-10-12 16:53:44 +02:00
2010-10-07 14:08:55 +01:00
2010-10-12 16:39:07 +02:00
2010-10-18 19:58:57 +02:00
2010-10-18 19:59:01 +02:00
2010-10-21 08:43:05 -07:00
2010-10-22 15:34:12 -05:00
2010-10-26 16:52:13 -07:00
2010-10-26 16:52:04 -07:00
2010-10-22 10:16:44 -07:00
2010-09-09 18:57:24 -07:00
2010-10-24 12:47:25 -07:00
2010-10-24 10:50:49 +02:00
2010-10-24 10:52:19 +02:00
2010-09-09 09:09:43 -07:00
2010-10-21 21:18:54 -04:00
2010-10-25 14:11:39 -07:00
2010-10-07 14:08:53 +01:00
2010-10-21 14:11:46 -07:00
2010-10-12 15:37:51 -07:00
2010-10-26 16:52:06 -07:00
2010-10-22 10:16:44 -07:00
2010-10-08 09:32:46 +02:00
2010-10-26 16:52:05 -07:00
2010-10-26 16:52:09 -07:00
2010-10-26 16:52:07 -07:00
2010-10-08 10:46:27 +02:00
2010-10-26 16:52:13 -07:00
2010-10-03 21:50:53 -07:00
2010-10-12 16:53:34 +02:00
2010-10-08 17:16:22 -05:00
2010-09-03 08:19:51 +02:00
2010-10-18 11:03:14 +02:00
2010-10-04 21:10:52 +02:00
2010-10-04 21:10:52 +02:00
2010-10-01 17:18:59 -04:00
2010-10-21 04:26:38 -07:00
2010-09-22 13:21:05 -07:00
2010-10-18 08:32:07 -07:00
2010-10-26 09:55:25 -07:00
2010-10-24 18:07:10 -04:00
2010-10-26 09:52:09 -07:00
2010-10-07 18:48:49 -04:00
2010-09-23 08:55:58 -04:00
2010-10-24 18:07:10 -04:00
2010-10-23 09:24:39 +09:00
2010-10-11 15:04:20 -04:00
2010-10-21 11:10:10 -06:00
2010-10-21 11:10:10 -06:00
2010-10-21 11:34:55 -06:00
2010-10-12 21:58:08 -06:00
2010-10-17 01:57:50 +02:00
2010-10-15 12:45:44 +02:00
2010-09-03 19:09:46 +08:00
2010-10-25 16:10:15 +02:00
2010-10-26 16:52:05 -07:00
2010-10-26 16:52:09 -07:00
2010-10-25 07:51:49 -07:00
2010-10-22 08:54:21 -07:00
2010-10-22 17:31:36 -07:00
2010-10-18 19:59:01 +02:00
2010-10-13 14:40:34 -07:00
2010-09-02 10:12:05 -07:00
2010-10-22 10:16:42 -07:00
2010-10-17 01:57:48 +02:00
2010-10-17 01:57:43 +02:00
2010-10-17 01:57:48 +02:00
2010-10-06 17:37:22 +04:00
2010-09-09 16:08:51 +02:00
2010-10-05 14:03:02 -07:00
2010-09-08 18:16:55 -07:00
2010-10-17 01:57:50 +02:00
2010-10-26 16:52:09 -07:00
2010-10-05 00:29:48 -07:00
2010-10-22 17:00:32 -07:00
2010-10-21 10:12:50 +11:00
2010-10-22 10:20:06 -07:00
2010-10-21 10:12:48 +11:00
2010-09-08 15:04:10 +02:00
2010-10-22 10:20:10 -07:00
2010-10-25 13:46:56 -07:00
2010-09-03 17:29:04 -07:00
2010-10-18 09:33:31 -07:00
2010-10-15 18:33:24 +09:00
2010-10-05 22:10:30 +09:00
2010-10-04 03:54:56 +09:00
2010-10-08 09:32:15 +02:00
2010-10-20 03:02:23 -07:00
2010-10-06 16:54:36 +03:00
2010-10-21 15:44:13 +02:00
2010-10-21 03:09:42 -07:00
2010-10-07 14:08:55 +01:00
2010-09-24 21:27:41 -07:00
2010-10-14 08:55:28 +02:00
2010-10-17 01:57:49 +02:00
2010-10-26 16:52:05 -07:00
2010-10-17 01:57:44 +02:00
2010-08-30 13:23:33 -07:00
2010-09-18 12:19:21 +02:00
2010-10-21 04:11:07 -07:00
2010-09-09 20:41:20 +02:00
2010-09-22 16:31:01 -04:00
2010-10-22 10:20:04 -07:00
2010-10-22 10:19:58 -07:00
2010-10-26 16:52:03 -07:00
2010-10-22 10:16:43 -07:00
2010-10-22 10:22:05 -07:00
2010-08-27 09:10:44 +10:00
2010-10-26 16:52:10 -07:00
2010-09-09 18:57:25 -07:00
2010-10-05 11:47:18 -07:00
2010-10-13 15:45:21 -04:00
2010-09-30 06:01:56 +03:00
2010-10-26 16:52:14 -07:00
2010-10-26 16:52:10 -07:00