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
F151063672: D49898.diff
Sun, Apr 5, 5:56 PM
Unknown Object (File)
Tue, Mar 17, 2:24 AM
Unknown Object (File)
Thu, Mar 12, 2:30 PM
Unknown Object (File)
Thu, Mar 12, 7:08 AM
Unknown Object (File)
Mon, Mar 9, 5:14 PM
Unknown Object (File)
Mon, Mar 9, 5:14 PM
Unknown Object (File)
Mon, Mar 9, 5:14 PM
Unknown Object (File)
Sun, Mar 8, 8:34 PM
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