diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/file.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -24,6 +24,8 @@ struct fdtable_defer { | |||
24 | struct fdtable *next; | 24 | struct fdtable *next; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | int sysctl_nr_open __read_mostly = 1024*1024; | ||
28 | |||
27 | /* | 29 | /* |
28 | * We use this list to defer free fdtables that have vmalloced | 30 | * We use this list to defer free fdtables that have vmalloced |
29 | * sets/arrays. By keeping a per-cpu list, we avoid having to embed | 31 | * sets/arrays. By keeping a per-cpu list, we avoid having to embed |
@@ -147,8 +149,8 @@ static struct fdtable * alloc_fdtable(unsigned int nr) | |||
147 | nr /= (1024 / sizeof(struct file *)); | 149 | nr /= (1024 / sizeof(struct file *)); |
148 | nr = roundup_pow_of_two(nr + 1); | 150 | nr = roundup_pow_of_two(nr + 1); |
149 | nr *= (1024 / sizeof(struct file *)); | 151 | nr *= (1024 / sizeof(struct file *)); |
150 | if (nr > NR_OPEN) | 152 | if (nr > sysctl_nr_open) |
151 | nr = NR_OPEN; | 153 | nr = sysctl_nr_open; |
152 | 154 | ||
153 | fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL); | 155 | fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL); |
154 | if (!fdt) | 156 | if (!fdt) |
@@ -233,7 +235,7 @@ int expand_files(struct files_struct *files, int nr) | |||
233 | if (nr < fdt->max_fds) | 235 | if (nr < fdt->max_fds) |
234 | return 0; | 236 | return 0; |
235 | /* Can we expand? */ | 237 | /* Can we expand? */ |
236 | if (nr >= NR_OPEN) | 238 | if (nr >= sysctl_nr_open) |
237 | return -EMFILE; | 239 | return -EMFILE; |
238 | 240 | ||
239 | /* All good, so we try */ | 241 | /* All good, so we try */ |