Re: [PATCH 05/19] VFS: add common error checks to lookup_one_qstr()

From: Al Viro
Date: Fri Feb 07 2025 - 15:14:59 EST


On Thu, Feb 06, 2025 at 04:42:42PM +1100, NeilBrown wrote:

> Callers of lookup_one_qstr() often check if the result is negative or
> positive.
> These changes can easily be moved into lookup_one_qstr() by checking the
> lookup flags:
> LOOKUP_CREATE means it is NOT an error if the name doesn't exist.
> LOOKUP_EXCL means it IS an error if the name DOES exist.
>
> This patch adds these checks, then removes error checks from callers,
> and ensures that appropriate flags are passed.
>
> This subtly changes the meaning of LOOKUP_EXCL. Previously it could
> only accompany LOOKUP_CREATE. Now it can accompany LOOKUP_RENAME_TARGET
> as well. A couple of small changes are needed to accommodate this. The
> NFS is functionally a no-op but ensures nfs_is_exclusive_create() does
> exactly what the name says.

Where's D/f/porting chunk? Mind you, this one needs _very_ careful
review and testing - you are touching codepaths that are convoluted
as hell and rarely tested.