@@ -139,12 +139,12 @@ struct file *alloc_empty_file(int flags, const struct cred *cred)
/*
* Privileged users can go above max_files
*/
- if (get_nr_files() >= files_stat.max_files && !capable(CAP_SYS_ADMIN)) {
+ if (get_nr_files() >= get_max_files() && !capable(CAP_SYS_ADMIN)) {
/*
* percpu_counters are inaccurate. Do an expensive check before
* we go and fail.
*/
- if (percpu_counter_sum_positive(&nr_files) >= files_stat.max_files)
+ if (percpu_counter_sum_positive(&nr_files) >= get_max_files())
goto over;
}
It is better to use get_max_files() instead of files_stat.max_files to improve readability. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> --- fs/file_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)