The following reply was made to PR kern/159663; it has been noted by GNATS.

From: Mikolaj Golub <troc...@freebsd.org>
To: Robert Millan <r...@freebsd.org>
Cc: Mikolaj Golub <troc...@freebsd.org>,  freebsd-gnats-sub...@freebsd.org,  
freebsd-bugs@freebsd.org,  Kostik Belousov <kostik...@gmail.com>,  Josef 
Karthauser <j...@freebsd.org>,  Adrian Chadd <adr...@freebsd.org>,  
freebsd...@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 <troc...@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,
 
 --=-=-=--
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to