linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] fs: Use get_max_files() instead of files_stat.max_files in alloc_empty_file()
@ 2020-06-06  6:32 Tiezhu Yang
  2020-06-06  6:32 ` [PATCH 2/3] fs: Introduce cmdline argument exceed_file_max_panic Tiezhu Yang
  2020-06-06  6:32 ` [PATCH 3/3] docs: admin-guide: Explain cmdline argument exceed_file_max_panic in fs.rst Tiezhu Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Tiezhu Yang @ 2020-06-06  6:32 UTC (permalink / raw)
  To: Alexander Viro, Jonathan Corbet
  Cc: linux-fsdevel, linux-doc, linux-kernel, Xuefeng Li

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(-)

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-06 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-06  6:32 [PATCH 1/3] fs: Use get_max_files() instead of files_stat.max_files in alloc_empty_file() Tiezhu Yang
2020-06-06  6:32 ` [PATCH 2/3] fs: Introduce cmdline argument exceed_file_max_panic Tiezhu Yang
2020-06-06 14:13   ` Matthew Wilcox
2020-06-06 14:28   ` Al Viro
2020-06-06  6:32 ` [PATCH 3/3] docs: admin-guide: Explain cmdline argument exceed_file_max_panic in fs.rst Tiezhu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).