Page MenuHomeFreeBSD

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

Authored by rmacklem on Fri, Apr 18, 11:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 23, 11:24 PM
Unknown Object (File)
Wed, Apr 23, 9:58 PM
Unknown Object (File)
Wed, Apr 23, 9:15 AM
Unknown Object (File)
Wed, Apr 23, 9:00 AM
Unknown Object (File)
Wed, Apr 23, 9:00 AM
Unknown Object (File)
Wed, Apr 23, 7:31 AM
Unknown Object (File)
Wed, Apr 23, 12:45 AM
Unknown Object (File)
Sun, Apr 20, 11:20 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 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
377

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.Sat, Apr 19, 10:19 PM