It is better to use get_max_files() instead of files_stat.max_files to improve readability. Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> --- fs/file_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 656647f..26516d0 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -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; } -- 2.1.0