Module Name: src Committed By: martin Date: Mon Jun 21 14:55:15 UTC 2021
Modified Files: src/sys/kern [netbsd-8]: vfs_lookup.c vfs_vnops.c src/sys/sys [netbsd-8]: namei.src Log Message: Pull up following revision(s) (requested by dholland in ticket #1685): sys/sys/namei.src: revision 1.59 (via patch) sys/kern/vfs_vnops.c: revision 1.215 sys/kern/vfs_lookup.c: revision 1.226 Add a new namei flag NONEXCLHACK for open with O_CREAT and not O_EXCL. This case needs to be distinguished from the other CREATE operations because it is supposed to successfully return (and open) the target if it exists. In the case where that target is the root, or a mount point, such that there's no parent dir, "real" CREATE operations fail, but O_CREAT without O_EXCL needs to succeed. So (a) add the flag, (b) test for it in namei in the situation described above, (c) set it in open under the appropriate circumstances, and (d) because this can result in namei returning ni_dvp of NULL, cope with that case. Should get into -9 and maybe even -8, because it was prompted by issues with 3rd-party code. The use of a flag (vs. adding an additional nameiop, which would be more appropriate) was deliberate to make the patch small and noninvasive. To generate a diff of this commit: cvs rdiff -u -r1.207.2.1 -r1.207.2.2 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.195.6.1 -r1.195.6.2 src/sys/kern/vfs_vnops.c cvs rdiff -u -r1.41 -r1.41.6.1 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.