Re: [PATCH 03/10] VFS: move want_write checks into lookup_hash_update()

From: Al Viro
Date: Fri Aug 26 2022 - 23:48:44 EST


On Fri, Aug 26, 2022 at 12:10:43PM +1000, NeilBrown wrote:
> mnt_want_write() is always called before lookup_hash_update(), so
> we can simplify the code by moving the call into that function.
>
> If lookup_hash_update() succeeds, it now will have claimed the
> want_write lock. If it fails, the want_write lock isn't held.
>
> To allow this, lookup_hash_update() now receives a 'struct path *'
> instead of 'struct dentry *'
>
> Note that when creating a name, any error from mnt_want_write() does not
> get reported unless there is no other error. For unlink/rmdir though,
> an error from mnt_want_write() is immediately fatal - overriding ENOENT
> for example. This behaviour seems strange, but this patch is careful to
> preserve it.

Would be a nice idea, if not for the mess with LOOKUP_SILLY_RENAME later
in the series...