3

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!

1
  • 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. ;-) Mar 2, 2011 at 2:49

1 Answer 1

2

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...

3
  • 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, 2011 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. Mar 2, 2011 at 2:47
  • 1
    The line in the link no longer points to relevant information; could you update the answer to contain what you were referring to without relying on the link? Jul 3, 2018 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .