Page MenuHomeFreeBSD

vfs_vnops.c: Fix the named attribute check for open
ClosedPublic

Authored by rmacklem on Apr 18 2025, 11:27 PM.
Tags
None
Referenced Files
F140709020: D49898.diff
Sat, Dec 27, 3:56 AM
Unknown Object (File)
Wed, Dec 10, 10:47 PM
Unknown Object (File)
Sat, Nov 29, 7:26 PM
Unknown Object (File)
Fri, Nov 28, 9:03 PM
Unknown Object (File)
Fri, Nov 28, 8:30 PM
Unknown Object (File)
Nov 6 2025, 9:11 PM
Unknown Object (File)
Nov 6 2025, 1:59 AM
Unknown Object (File)
Nov 5 2025, 2:22 AM
Subscribers

Details

Summary

In vn_open_cred(), the correct check for O_NAMEDATTR
was done when O_CREAT was specified, but the file already
exists. (Added by commit 2ec2ba7e232d, which will be listed
as a Fixes: in the commit log message.)

This correct check was not copied to the case where O_CREAT
has not been specified.

This patch fixes this.

Test Plan

Tested with a system where ZFS is patched to handle
named attributes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I now realize that the check for non-named attribute is in
ZFS's VOP_LOOKUP(), so this patch is not really needed,
but I think it is a good "safety belt" to put in.

sys/kern/vfs_vnops.c.sav
386

Can we introduce a helper to calculate error for both pathes, and avoid code duplication?

rmacklem marked an inline comment as done.

Added a helper function, as suggested by kib@.

This revision is now accepted and ready to land.Apr 19 2025, 10:19 PM