From: Peeter Joot <peeter@joot.com>
Subject: patch: new sysctl to remove hardcoded ELOOP limit
To: torvalds@transmeta.com
Date: Thu, 9 Apr 1998 01:46:27 -0400 (EDT)
Hi,
Currently 5 symlinks will be followed before ELOOP is returned. Today
I had a need for this to be 6 on my system. Rather than just hacking the
value and recompiling it I thought it made more sense to have a sysctl so
this is adjustable.
I am appending a small patch against 2.1.94 for this. I have tested this
on 2.1.82, and merged the changes into 2.1.94 for the patch. It hasn't
actually been tested on 2.1.94, but I can't imagine there are any problems --
it is a very simple modification.
Peeter
--
Peeter Joot
http://www.accessv.com/~peeter peeter@accessv.com, Peeter_Joot@ca.ibm.com
diff --recursive -u linux.94/Documentation/sysctl/kernel.txt linux/Documentation/sysctl/kernel.txt
--- linux.94/Documentation/sysctl/kernel.txt Thu Mar 19 18:04:30 1998
+++ linux/Documentation/sysctl/kernel.txt Thu Apr 9 01:30:02 1998
@@ -34,6 +34,7 @@
- real-root-dev ==> Documentation/initrd.txt
- reboot-cmd ==> SPARC specific
- securelevel
+- symlinks-max
- version
==============================================================
@@ -209,4 +210,11 @@
??? This seems to be a way to give an argument to the Sparc
ROM/Flash boot loader. Maybe to tell it what to do after
rebooting. ???
+
+==============================================================
+
+symlinks-max:
+
+Control how many symbolic links will be followed before ELOOP
+is returned. The default is 5.
diff --recursive -u linux.94/fs/namei.c linux/fs/namei.c
--- linux.94/fs/namei.c Mon Jan 12 18:03:28 1998
+++ linux/fs/namei.c Thu Apr 9 01:25:20 1998
@@ -80,6 +80,7 @@
static char * quicklist = NULL;
static int quickcount = 0;
struct semaphore quicklock = MUTEX;
+int max_symlinks = 5;
/* Tuning: increase locality by reusing same pages again...
* if quicklist becomes too long on low memory machines, either a limit
@@ -303,7 +304,7 @@
struct inode * inode = dentry->d_inode;
if (inode && inode->i_op && inode->i_op->follow_link) {
- if (current->link_count < 5) {
+ if (current->link_count < max_symlinks) {
struct dentry * result;
current->link_count++;
diff --recursive -u linux.94/include/linux/fs.h linux/include/linux/fs.h
--- linux.94/include/linux/fs.h Wed Apr 8 21:15:10 1998
+++ linux/include/linux/fs.h Thu Apr 9 01:25:20 1998
@@ -43,6 +43,7 @@
/* And dynamically-tunable limits and defaults: */
extern int max_inodes;
+extern int max_symlinks;
extern int max_files, nr_files, nr_free_files;
#define NR_INODE 4096 /* This should no longer be bigger than NR_FILE */
#define NR_FILE 4096 /* this can well be larger on a larger system */
diff --recursive -u linux.94/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux.94/include/linux/sysctl.h Wed Apr 1 19:19:57 1998
+++ linux/include/linux/sysctl.h Thu Apr 9 01:27:35 1998
@@ -72,7 +72,8 @@
KERN_STATINODE,
KERN_DENTRY, /* dentry statistics */
KERN_MODPROBE,
- KERN_KMOD_UNLOAD_DELAY
+ KERN_KMOD_UNLOAD_DELAY,
+ KERN_MAXSYMLINKS /* max levels of symbolic links */
};
diff --recursive -u linux.94/kernel/sysctl.c linux/kernel/sysctl.c
--- linux.94/kernel/sysctl.c Wed Apr 1 19:26:35 1998
+++ linux/kernel/sysctl.c Thu Apr 9 01:26:44 1998
@@ -187,6 +187,8 @@
{KERN_NRFILE, "sg-big-buff", &sg_big_buff, sizeof (int),
0444, NULL, &proc_dointvec},
#endif
+ {KERN_MAXSYMLINKS, "symlinks-max", &max_symlinks, sizeof(int),
+ 0644, NULL, &proc_dointvec},
{0}
};
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu