From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 27 06:49:13 2011 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D146D1065674; Tue, 27 Sep 2011 06:49:13 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 15BE48FC16; Tue, 27 Sep 2011 06:49:11 +0000 (UTC) Received: by fxg9 with SMTP id 9so8711933fxg.13 for ; Mon, 26 Sep 2011 23:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=0pPRj+2bdErfuLt2DQENbDyKCnBV4ZrVc/yxxGI0h10=; b=mcB4rI0CqNO/8GzGMvyuXd8768k37UZH64WzB18hr1svUWgiMYtwzPa7Fqt70f2AkJ wmFsuoqSFNWLCfL3dxv9IMcHTKy82MYpsExnimDuuVG9MzbU6+2H7fmxmrev0ddgY7nD JdpucBTt5bskNAQQuMZ5UswzqojifSMwC3kFY= Received: by 10.223.48.69 with SMTP id q5mr11953485faf.80.1317106151152; Mon, 26 Sep 2011 23:49:11 -0700 (PDT) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id y8sm22643787faj.10.2011.09.26.23.49.09 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Sep 2011 23:49:09 -0700 (PDT) From: Mikolaj Golub To: Robert Millan Organization: TOA Ukraine References: <201108102152.p7ALqUl4075207@red.freebsd.org> <201108102200.p7AM0Nu9026320@freefall.freebsd.org> <86k48wz3mc.fsf@kopusha.home.net> Sender: Mikolaj Golub Date: Tue, 27 Sep 2011 09:49:08 +0300 In-Reply-To: (Robert Millan's message of "Tue, 27 Sep 2011 07:36:28 +0200") Message-ID: <86litajx97.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: Josef Karthauser , freebsd-fs@freebsd.org, freebsd-bugs@freebsd.org, Adrian Chadd , Mikolaj Golub , Kostik Belousov , FreeBSD-gnats-submit@freebsd.org 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 List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2011 06:49:14 -0000 --=-=-= 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, --=-=-=--