Data reads and writes should not need credentials, and most filesystems
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 10 Oct 2003 22:01:13 +0000 (22:01 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 10 Oct 2003 22:01:13 +0000 (22:01 +0000)
commitc1cf1e5959e516dfdd8f3e263ba54bfa4750cb58
treedbf689cefc684e7d1cb0d9e4c7a0c77f6a5dd4f9
parentbc0c094e30504ceeedcb8e3d5c882a9b35ba604c
Data reads and writes should not need credentials, and most filesystems
ignore the ucred argument.  NFS does, though, and FreeBSD-4.x had some
terrible hacks to associate credentials with data that only 'mostly' worked.
There were VM paging and buffer reconstitution cases which broke the
credentials even in 4.x.  The hacks were removed from DragonFly during
the VFS messaging reorganization.

In DragonFly credentials are checked on open() but no credentials are
required for read and write ops.  I had NFS just use the 'root' credential
for the RPC.  However, this breaks NFS mounts which do not use the -maproot
(server side) directive.  Really the bug is on the server side, but to
maintain general compatibility with NFS servers we have to provide a
non-root credential if root did not issue the I/O.  This commit hacks up
the NFS code (rather then hacking up the rest of the kernel) to restore
the hacks that were previously removed from the kernel.  Unfortunately it
can lead to a proliferation of ucred structures (FreeBSD-4.x did as well),
but that's the price we have to pay for now.

Report-by: Galen Sampson <galen_sampson@yahoo.com>
sys/vfs/nfs/nfs_node.c
sys/vfs/nfs/nfs_nqlease.c
sys/vfs/nfs/nfs_subs.c
sys/vfs/nfs/nfs_vfsops.c
sys/vfs/nfs/nfs_vnops.c
sys/vfs/nfs/nfsmount.h
sys/vfs/nfs/nfsnode.h