Re: race between vfs_rename and do_linkat (mv and link)

From: Miklos Szeredi
Date: Fri Feb 18 2022 - 10:38:06 EST


On Wed, 16 Feb 2022 at 14:37, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:

> One issue with the patch is nesting of lock_rename() calls in stacked
> fs (rwsem is not allowed to recurse even for read locks).

Scratch that, there's no recursion since do_linkat() is not called
from stacked fs. And taking link_rwsem is optional for the link
operation, so this is fine. For stacked fs the race is hopefully
taken care by the top layer locking, no need to repeat it in lower
layers.

I've now sent this patch with a proper header comment to Al.

Thanks,
Miklos