From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 27 06:50:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E7321065674 for ; Tue, 27 Sep 2011 06:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 44E168FC1C for ; Tue, 27 Sep 2011 06:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8R6o8pZ085245 for ; Tue, 27 Sep 2011 06:50:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8R6o8db085244; Tue, 27 Sep 2011 06:50:08 GMT (envelope-from gnats) Date: Tue, 27 Sep 2011 06:50:08 GMT Message-Id: <201109270650.p8R6o8db085244@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Mikolaj Golub Cc: Subject: Re: kern/159663: sockets don't work though nullfs mounts X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mikolaj Golub List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2011 06:50:09 -0000 The following reply was made to PR kern/159663; it has been noted by GNATS. From: Mikolaj Golub To: Robert Millan Cc: Mikolaj Golub , FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org, Kostik Belousov , Josef Karthauser , Adrian Chadd , 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 : >> 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, --=-=-=--