Re: [PATCH 02/20] STAGING/lustre: limit follow_link recursion using stack space.

Al Viro
2015-04-18T03:01:34Z

On Mon, Mar 23, 2015 at 01:37:38PM +1100, NeilBrown wrote:
> lustre's ->follow_link() uses a lot of stack space and so
> need to limit symlink recursion based on stack size.
>
> It currently tests current->link_count, but that will soon
> become private to fs/namei.c.
> So instead base on actual available stack space.
> This patch aborts recursive symlinks in less than 2K of space
> is available. This seems consistent with current code, but
> hasn't been tested.

BTW, in the best case that logics is fishy. We have "up to 5 levels
with 4Kb stack and up to 7 with 8Kb one". Could somebody manage to dig out
the reasons for such limits? Preferably along with the kernel version where
the overflows had been observed, both for 4K and 8K cases.

I'm very tempted to rip that thing out in the "kill link_path_walk()
recursion completely" series...