]> git.ipfire.org Git - thirdparty/linux.git/commit
vfs: move create error && negative dentry case in lookup_open() up
authorJori Koolstra <jkoolstra@xs4all.nl>
Fri, 10 Jul 2026 16:42:31 +0000 (18:42 +0200)
committerChristian Brauner <brauner@kernel.org>
Thu, 30 Jul 2026 10:16:55 +0000 (12:16 +0200)
commit4d315e54aa898ea491ce2fe72ee482f74b7ba84a
treeb166aa79edd59e2baa857941be450b60f7c16e35
parent24f3a09163caad1dde3f801f1bafc69f1991a357
vfs: move create error && negative dentry case in lookup_open() up

O_CREAT is stripped when create_error is set in lookup_open(), so when
lookup does not return an inode, the case

if (!dentry->d_inode && (open_flag & O_CREAT))

is always skipped. We can get rid of this cognitive step by handling the
error case first.

Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260710164233.827744-2-jkoolstra@xs4all.nl
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/namei.c