ggated doesn't close local file after closing client connections.
By the way, the patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/132798 also includes this fix, too. I decided to file this because it is a separate issue.
Add the following in connection_remove function in sbin/ggate/ggated/ggated.c
if(conn->c_diskfd == -1)
connection_remove(struct ggd_connection *conn)
g_gate_log(LOG_DEBUG, "Connection removed [%s %s].",
ip2str((struct sockaddr*)&conn->c_srcaddr), conn->c_path);
if (conn->c_sendfd != -1)
if (conn->c_recvfd != -1)
How-To-Repeat: server# ggated
client# ggatec create -oro server /dev/da0
client# ggatec destroy -u 0
server# mount -orw /dev/da0 /mnt/backup
RW mount on server fails because ggated remain /dev/da0 opened.
Over to maintainer(s).
This has been quite a while and I happened to open this after seeing an update.
Looking at the report myself and ggated, ggated grabs all files in the export file at start time. My report indicates that a file was still locked while ggated was alive although a client disconnected.
It doesn't sound like a bug but rather feature to keep files locked while the daemon is running.
From my look at it, it looks like ggated opens the device twice when the client connects.
When I repeatedly cycled the client, it seemed to leak 1 GEOM reference each time.
I will write up some reproduction steps over the weekend
Multiple ggated file descriptor leaks have been fixed in ElectroBSD and reported to the FreeBSD SO in 2014 and 2015 because of the DoS aspect.
For detail see:
and grep for ggate.
For bugs that match the following
- Status Is In progress
- Untouched since 2018-01-01.
- Affects Base System OR Documentation
Reset to open status.
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.