Bug 252331 - zfs over ggate terminates ggated with 0 length read
Summary: zfs over ggate terminates ggated with 0 length read
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-geom (Nobody)
Depends on:
Reported: 2021-01-01 16:44 UTC by ota
Modified: 2021-07-20 00:39 UTC (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description ota 2021-01-01 16:44:44 UTC
When ZFS is used over ggate devises, ggated somehow receives 0 length read and results in terminating ggatec and ggated connection.

How to reproduce:

% mdconfig -a -t swap -s 1GB
% echo RW /dev/md0 > /tmp/ggated.conf
% ggated /tmp/ggated.conf
% ggatec create -orw /dev/md0
% zpool create -m /mnt/test test /dev/ggate0
% cp -pr /usr/src/ /mnt/test/
ggate connection is dropped randomly.

After running truss, I discovered that ggated read 0 length input from a socket and closes the connection although ggatec does not write 0 length over the connection.  As a result, ggatec terminates its connection as well and zfs/cp hangs.
Comment 1 Fabian Keil 2021-01-01 18:19:22 UTC
I could not reproduce the problem on ElectroBSD based on 11.4-STABLE r368530.

The cp fails with "No space left on device" as can be expected from the small pool size.

I'm wondering if you're running into ggated recv_thread() queuing incomplete WRITE requests.

I've reported this and other ggate-related issues in 2015 to <security-officer@FreeBSD.org> but AFAIK it still hasn't been fixed upstream.

You could try the patch from:
Comment 2 Peter Jeremy freebsd_committer 2021-07-04 08:46:15 UTC
I'm also unable to reproduce this on 14-current g07564e176201.  Are you able to reliably reproduce the problem?  If so, could you share the truss or ktrace output.