From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 25 15:40:13 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 956F1106566C for ; Sun, 25 Sep 2011 15:40:13 +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 840698FC16 for ; Sun, 25 Sep 2011 15:40:13 +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 p8PFeDCG074568 for ; Sun, 25 Sep 2011 15:40:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8PFeDcm074567; Sun, 25 Sep 2011 15:40:13 GMT (envelope-from gnats) Date: Sun, 25 Sep 2011 15:40:13 GMT Message-Id: <201109251540.p8PFeDcm074567@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Robert Millan 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: Robert Millan List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 15:40:13 -0000 The following reply was made to PR kern/159663; it has been noted by GNATS. From: Robert Millan To: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org Cc: Kostik Belousov , Adrian Chadd , Josef Karthauser , freebsd-fs@freebsd.org Subject: Re: kern/159663: sockets don't work though nullfs mounts Date: Sun, 25 Sep 2011 17:32:27 +0200 2011/9/24 Robert Millan : > I found a thread from 2007 with further discussion about this problem: > > http://lists.freebsd.org/pipermail/freebsd-fs/2007-February/002669.html Hi, I've looked at the situation in a bit more detail, for now only with sockets in mind (not named pipes). My understanding is (please correct me if I'm wrong): - nullfs holds reference counts for each vnode, but sockets have their own mechanism for reference counting (so_count / soref / sorele). vnode reference counting doesn't protect against socket being closed, which would leave a stale pointer in the upper nullfs layer. - Increasing the reference count of the socket itself can't be done in null_nodeget() because this function is merely a getter whose call doesn't indicate any meaningful event. - It's not clear to me that there's any event in time where the socket reference can be increased. If mounting a nullfs were that event, then all existing sockets would be soref'ed but we wouldn't be soref'ing future sockets created in the lower layer after the mount. This doesn't seem correct. - Possible solution: null_nodeget() semantics are replaced with something that actually allows vnodes in the upper layer to be created and destroyed. - Possible solution: upper layer has a memory structure to keep track of which sockets in the lower layer have been soref'ed.