Date: Tue, 27 Sep 2011 06:50:08 GMT From: Mikolaj Golub <trociny@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/159663: sockets don't work though nullfs mounts Message-ID: <201109270650.p8R6o8db085244@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/159663; it has been noted by GNATS.
From: Mikolaj Golub <trociny@freebsd.org>
To: Robert Millan <rmh@freebsd.org>
Cc: Mikolaj Golub <trociny@freebsd.org>, FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org, Kostik Belousov <kostikbel@gmail.com>, Josef Karthauser <joe@freebsd.org>, Adrian Chadd <adrian@freebsd.org>, freebsd-fs@freebsd.org
Subject: Re: kern/159663: sockets don't work though nullfs mounts
Date: Tue, 27 Sep 2011 09:49:08 +0300
--=-=-=
On Tue, 27 Sep 2011 07:36:28 +0200 Robert Millan wrote:
RM> 2011/9/25 Mikolaj Golub <trociny@freebsd.org>:
>> As a proof of concept below is a patch that implements it.
RM> This works very well, I'm currently using your patch to run X11 over a
RM> nullfs-mounted /tmp.
>> The issues with this approach I see so far:
>>
>> - we need an additional flag for namei;
RM> What does this involve?
Well, adding yet another flag just to handle this one case might be not very
good idea :-)
But actually it is possible to do without the additional flag, with the only
hack in nullfs code: in lookup and create return lower vnode if it is a
socket, like in the patch below. It works for me but I have not tested much
and not checked yet if use cases are possible when this makes undesirable
effect.
--
Mikolaj Golub
--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=nullfs.VSOCK.patch
Index: sys/fs/nullfs/null_vnops.c
===================================================================
--- sys/fs/nullfs/null_vnops.c (revision 225757)
+++ sys/fs/nullfs/null_vnops.c (working copy)
@@ -365,16 +365,38 @@ null_lookup(struct vop_lookup_args *ap)
vrele(lvp);
} else {
error = null_nodeget(dvp->v_mount, lvp, &vp);
- if (error)
+ if (error) {
vput(lvp);
- else
+ } else if (vp->v_type == VSOCK) {
+ vref(lvp);
+ vrele(vp);
+ *ap->a_vpp = lvp;
+ } else {
*ap->a_vpp = vp;
+ }
}
}
return (error);
}
static int
+null_create(struct vop_create_args *ap)
+{
+ struct vnode *vp, *lvp;
+ int retval;
+
+ retval = null_bypass(&ap->a_gen);
+ vp = *ap->a_vpp;
+ if (retval == 0 && vp->v_type == VSOCK) {
+ lvp = NULLVPTOLOWERVP(vp);
+ vref(lvp);
+ vrele(vp);
+ *ap->a_vpp = lvp;
+ }
+ return (retval);
+}
+
+static int
null_open(struct vop_open_args *ap)
{
int retval;
@@ -826,6 +848,7 @@ struct vop_vector null_vnodeops = {
.vop_accessx = null_accessx,
.vop_advlockpurge = vop_stdadvlockpurge,
.vop_bmap = VOP_EOPNOTSUPP,
+ .vop_create = null_create,
.vop_getattr = null_getattr,
.vop_getwritemount = null_getwritemount,
.vop_inactive = null_inactive,
--=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109270650.p8R6o8db085244>
