Re: max directory depth in 2.2.15? Bug?

From: Khimenko Victor (khim@sch57.msk.ru)
Date: Mon May 29 2000 - 18:34:00 EST


In <677357028.20000529204004@gmx.net> Sven Kirmess (sven.kirmess@gmx.net) wrote:
> Is there a max dir depth in 2.2.15?

No. And why there should be one ? How you can handle rename(2) effectively
with such limit ?

> I always though it is limited to 1024 but that doesn't seem to be true.

It's different limit. There are MAX_PATH limit for filename but if you'll
play with chdir(2) you can construct MUCH bigger filename (just as you did).

> I created some directories with the following command.

> i=10000; while mkdir $i; do cd $i; echo $i; i=`expr 1 + $i`; done

Why to start from 10000 ? It does not change anything. I was able to create
more then 100000 directories with such command (I stopped it since bash
started to complain loudly - perhaps when some internal buffer for pwd
overflowed) and then stopped it. Of course I increased inode-max before
starting it to be safe :-)

> It proceeded up to about 178xx. Then I got a permission denied error
> (as root). I restarted the command and got about 10 new directories.
> Then again, I got a permission denied.

No wonder. You reached inode-max and kernel went berserk.

> Additionally, I got some syslog. Very much " grow_inodes: inode-max
> limit reached". I deleted some of them. In the end other programms
> get problems like squid (see syslog) and even ls didn't work
> sometimes (permission denied). (Sometimes means, I rapidly unmounted
> the test partition because I didn't wanne harm the system.

> Is that the normal behaviour or is it a bug?

Is that "normal behaviour" is interesting question. It's by linux's VFS design
not by problems in implementation. Nice local DoS :-/ Unfrtunatelly there are
quite a few other local DoS attacks so I'm not sure if someone will try to fix
it soon. You can use quota to limit problems: just not allow to create more
then 1000 files per user and raise inode-max to 1000000 :-)

P.S. You can change VFS parameters via /proc/sys/fs/*-max ...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:22 EST