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)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-01 16:44 UTC by ota
Modified: 2021-01-09 04:05 UTC (History)
2 users (show)

See Also:


Attachments

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
md0
% echo 127.0.0.1 RW /dev/md0 > /tmp/ggated.conf
% ggated /tmp/ggated.conf
% ggatec create -orw 127.0.0.1 /dev/md0
ggate0
% 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:
<https://www.fabiankeil.de/sourcecode/electrobsd/ElectroBSD-r312620-6cfa243f1516/0021-ggated-recv_thread-Do-not-queue-incomplete-WRITE-requ.diff>