diff options
author | trociny <trociny@FreeBSD.org> | 2012-02-29 21:38:31 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2012-02-29 21:38:31 +0000 |
commit | 1aad0004eef0a2c8cc3f79dd3a6f03dd46dd047a (patch) | |
tree | 68c4dc3240253dab5bf3767c81e64d876b2ec226 /sys/kern/vfs_default.c | |
parent | 7f479f0242bfa3392b0ad6d21188de6300c5576f (diff) | |
download | FreeBSD-src-1aad0004eef0a2c8cc3f79dd3a6f03dd46dd047a.zip FreeBSD-src-1aad0004eef0a2c8cc3f79dd3a6f03dd46dd047a.tar.gz |
Introduce VOP_UNP_BIND(), VOP_UNP_CONNECT(), and VOP_UNP_DETACH()
operations for setting and accessing vnode's v_socket field.
The operations are necessary to implement proper unix socket handling
on layered file systems like nullfs(5).
This change fixes the long standing issue with nullfs(5) being in that
unix sockets did not work between lower and upper layers: if we bound
to a socket on the lower layer we could connect only to the lower
path; if we bound to the upper layer we could connect only to the
upper path. The new behavior is one can connect to both the lower and
the upper paths regardless what layer path one binds to.
PR: kern/51583, kern/159663
Suggested by: kib
Reviewed by: arch
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_default.c')
-rw-r--r-- | sys/kern/vfs_default.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index e47498e..25278c8 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -123,6 +123,9 @@ struct vop_vector default_vnodeops = { .vop_unlock = vop_stdunlock, .vop_vptocnp = vop_stdvptocnp, .vop_vptofh = vop_stdvptofh, + .vop_unp_bind = vop_stdunp_bind, + .vop_unp_connect = vop_stdunp_connect, + .vop_unp_detach = vop_stdunp_detach, }; /* @@ -1037,6 +1040,30 @@ vop_stdadvise(struct vop_advise_args *ap) return (error); } +int +vop_stdunp_bind(struct vop_unp_bind_args *ap) +{ + + ap->a_vp->v_socket = ap->a_socket; + return (0); +} + +int +vop_stdunp_connect(struct vop_unp_connect_args *ap) +{ + + *ap->a_socket = ap->a_vp->v_socket; + return (0); +} + +int +vop_stdunp_detach(struct vop_unp_detach_args *ap) +{ + + ap->a_vp->v_socket = NULL; + return (0); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. |