Date: Wed, 09 Feb 2011 00:31:31 +0200 From: Mikolaj Golub <to.my.trociny@gmail.com> To: freebsd-fs@FreeBSD.org Cc: Pawel Jakub Dawidek <pjd@freebsd.org> Subject: HAST: unix socket issue Message-ID: <86lj1qgnuk.fsf@kopusha.home.net>
next in thread | raw e-mail | index | archive | help
--=-=-= Hi, Currently hastd on termination does not remove control socket file. This is because of the bug in uds_accept(): in accept() it passes the old sockaddr instead of the new one. As a result sun_path is reseted in the initial socket while sockaddr for the new socket is left uninitialized. See the attached patch. Later when unlink is called on a socket close it fails because the path is empty or some garbage. But after fixing this issue another problem shows up, which is masked by the first bug: in the child process we close all unneeded descriptors. For a unix socket uds_close() will unlink the socket file, which we still need for parent. E.g. control socket file will be removed on a worker start. It looks like we need some way to tell uds_close() not to remove the file in such cases, e.g. setting a flag in socket structure before proto_close() or adding proto_close_without_unlink() (can't think out a good name :-) -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=proto_uds.c.uds_accept.patch Index: sbin/hastd/proto_uds.c =================================================================== --- sbin/hastd/proto_uds.c (revision 218456) +++ sbin/hastd/proto_uds.c (working copy) @@ -201,7 +201,7 @@ uds_accept(void *ctx, void **newctxp) return (errno); fromlen = sizeof(uctx->uc_sun); - newuctx->uc_fd = accept(uctx->uc_fd, (struct sockaddr *)&uctx->uc_sun, + newuctx->uc_fd = accept(uctx->uc_fd, (struct sockaddr *)&newuctx->uc_sun, &fromlen); if (newuctx->uc_fd < 0) { ret = errno; --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lj1qgnuk.fsf>