Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running into the following Linux error: Too many levels of symbolic links.
This seems to be caused by the system limit of 8 maximum link-chain size, and I'm looking for a way to increase this limit.

Some background:
I am writing a system which makes use of symlinks to pass on file resources between working elements. This results in long chains of symlinks (e.g. a->b->c->d->e...->z). I am creating a chain intentionally, as I'm interested in preserving this structure of who-provided what. It should be noted that this system is physically disconnected from the outside world, so I have practically no concerns for security or exploit prevention.

All help would be greatly appreciated!

share|improve this question
    
Have you considered using an actual database rather than using the file-system as you are? Doing these sorts of tricks can often be easy, but they can also cause huge pain down the road. I'm currently in the process of cleaning up one that I implemented 10 years ago, and a client has one that causes backups to take 36 hours, so I have some experience with this. ;-) –  Sean Reifschneider Mar 2 '11 at 2:49
add comment

1 Answer

up vote 1 down vote accepted

Looks like you'll need to rebuild the kernel, modifying "MAX_NESTED_LINKS" in "namei.h". It's hard-coded, see line 808 of fs/namei.c.

Note, of course, that the performance of symlinks is terrible, I hope you don't have to access these links very frequently...

share|improve this answer
    
I was afraid there was no other way... Oh well. Re performance, I'm accessing them quite a bit but they are links to giant files, so I'm reading actual data much more than I access the links. I guess that should eliminate symlink performance effect. –  Yonatan Mar 1 '11 at 13:41
    
Symlinks are multiple seeks to read, where a large file tends to be packed sequentially. On a hard drive that has 100MB/sec transfer rate and 10ms access time, a seek "costs" the same as accessing 1MB sequentially. If each symlink takes 4 seeks (I don't honestly know, but I think that's a reasonable guess), and you are doing 26 of them, the symlinks could cost more than reading a 100MB file. Caching will change this profile, but caching of directory entries often isn't as effective as you might like for big directory structures. –  Sean Reifschneider Mar 2 '11 at 2:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.