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
Unknown Object (File)
Sep 12 2025, 6:18 PM
Unknown Object (File)
Sep 12 2025, 3:47 PM
Unknown Object (File)
Sep 11 2025, 1:20 PM
Unknown Object (File)
Sep 8 2025, 3:17 AM
Unknown Object (File)
Sep 3 2025, 5:08 PM
Unknown Object (File)
Aug 25 2025, 12:00 PM
Unknown Object (File)
Aug 19 2025, 10:08 AM
Unknown Object (File)
Aug 19 2025, 1:52 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 Not Applicable
Unit
Tests Not Applicable

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
377 ↗(On Diff #153892)

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