Differences between version 3 and previous revision of ELOOP.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 3 | Last edited on Friday, January 7, 2005 8:10:54 pm | by JohnMcPherson | Revert |
Older page: | version 2 | Last edited on Friday, January 7, 2005 1:03:06 am | by JuergenNickelsen | Revert |
@@ -2,4 +2,30 @@
To prevent symbolic links linking back to themselves and causing an infinite loop in the kernel, the kernel stops after a certain number of symbolic links have been followed with ELOOP. This doesn't necessarily mean that there is a loop, but that there are too many symbolic links encountered.
The maximum number of symbolic links followed is currently 5 (with Linux 2.4.27). To match other operating systems with higher limits (e. g. Solaris 9 with 20, FreeBSD 5.3 with 32), there is ongoing work to increase that limit.
+
+In linux kernel 2.6.9, fs/namei.h contains the following:
+<verbatim>
+enum { MAX_NESTED_LINKS = 5 };
+</verbatim>
+and fs/namei.c contains the following:
+<verbatim>
+...
+static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+ int err = -ELOOP;
+ if (current->link_count >= MAX_NESTED_LINKS)
+ goto loop;
+ if (current->total_link_count >= 40)
+ goto loop;
+...
+
+</verbatim>
+
+<verbatim>
+ error = -ELOOP;
+ if (count++==32) {
+ putname(nd->last.name);
+ goto exit;
+ }
+</verbatim>