patch-pre2.0.13 linux/fs/file_table.c

Next file: linux/fs/nfs/rpcsock.c
Previous file: linux/fs/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.12/linux/fs/file_table.c linux/fs/file_table.c
@@ -101,8 +101,15 @@
 struct file * get_empty_filp(void)
 {
 	int i;
+	int max = max_files;
 	struct file * f;
 
+	/*
+	 * Reserve a few files for the super-user..
+	 */
+	if (current->euid)
+		max -= 10;
+
 	/* if the return is taken, we are in deep trouble */
 	if (!first_file && !grow_files())
 		return NULL;
@@ -117,7 +124,7 @@
 				f->f_version = ++event;
 				return f;
 			}
-	} while (nr_files < max_files && grow_files());
+	} while (nr_files < max && grow_files());
 
 	return NULL;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this