]> git.ipfire.org Git - thirdparty/linux.git/commit
VFS: move mnt_want_write() and locking into lookup_open()
authorNeilBrown <neil@brown.name>
Tue, 14 Jul 2026 23:04:12 +0000 (09:04 +1000)
committerChristian Brauner <brauner@kernel.org>
Thu, 23 Jul 2026 13:42:48 +0000 (15:42 +0200)
commitddb6e6c72a0ab0b1f08ee30e3ab888257d8d3c80
tree1c0c8ed69fdbfa04a27d6138062a58d80121ed8b
parentdc59e4fea9d83f03bad6bddf3fa2e52491777482
VFS: move mnt_want_write() and locking into lookup_open()

The mnt_want_write() call and the parent inode locking in
open_last_lookups() are only needed for lookup_open().  So we can move
them and all the got_write handling into lookup_open().

Note that we need to also check create_error when determining whether to
unlock shared or not, as O_CREAT can be cleared, but create_error is
only set of O_CREAT was set.

The fsnotify calls come too as they must be in the locked region.

Also use the existing dir_inode uniformly for dir->d_inode.

This is a step towards exporting an better "open/create" interface to nfsd.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jori Koolstra <jkoolstra@xs4all.nl>
Signed-off-by: NeilBrown <neil@brown.name>
Link: https://patch.msgid.link/20260714230534.776886-2-neilb@ownmail.net
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/namei.c