Created attachment 152537 [details] Easy work arond to unbreak ggatec <-> ggated but break HAST ggated disconnects ggatec connections immediately. The server side prints "ioctl(/dev/ggctl): Invalid argument." https://svnweb.freebsd.org/base?view=revision&revision=238119 looks to be the cause. The server side expects gctl_readprov[] to be filled with geom provider but ggatec does not pass such argument. 10.0 RELEASE and thereafter seem to be affected by this. The attached patch allows ggatec and ggated to communicate again but as the change mention HAST and I don't know how it really works and never used it, the patch may break HAST.
What are the required steps to reproduce the problem? ggatec and ggated work as expected on all my systems and given that r238119 is from 2012, most of them already have it.
Created attachment 154318 [details] server side reproduce procedure I captured ggated configuration and steps by 'script.' Once ggated is started, run "ggatec create -o rw 127.0.0.1 /dev/md1" on another terminal.
The steps work as expected for me. Tested on: FreeBSD kendra 10.1-STABLE FreeBSD 10.1-STABLE #0 r279989+96d5981(stable/10): Tue Mar 17 19:45:41 CET 2015 fk@kendra:/usr/obj/usr/src/sys/GENERIC amd64
Really? I wondered if my local changes caused this although I don't have any ggate related changes and tried raw image from the FreeBSD official site. I did the same commands and failed again. root@:~ # mdconfig -a -t swap -s 10M md0 root@:~ # echo '127.0.0.1 RW /dev/md0' > /tmp/gg.exports root@:~ # ggated /tmp/gg.exports root@:~ # ggatec create -o rw 127.0.0.1 /dev/md0 Mar 26 02:52:16 ggatec: ggatec: ioctl(/dev/ggctl): Invalid argument. Mar 26 02:52:16 ggatec: Existing. root@:~ # uname -a FreeBSD 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 22:51:51 UTC 2014 root@releng1.nyu.freebsd:/usr/obj/usr/src/sys/GENERIC i386
Note that I'm only using ggated on amd64 systems. Maybe it's an architecture-specific bug, for example a variable size mismatch.
Created attachment 155621 [details] ggatec: In g_gatec_create(), don't pass stack garbage to the kernel I reproduced the problem on i386. Fix attached.
Yes, the patch fixed the issue and I confirmed that I can establish a connection.
Thank you for the patch Fabian. CC original committer (pjd) for what appears to be very simple (and confirmed) fix, for resolution in 10.2-RELEASE
A commit references this bug: Author: brueffer Date: Tue Jul 14 10:49:37 UTC 2015 New revision: 285531 URL: https://svnweb.freebsd.org/changeset/base/285531 Log: Unbreak ggatec and ggatel on i386 after r238119, which added two more 'struct g_gate_ctl_create' fields. While the behaviour was technically undefined on other architectures as well, on the reporter's amd64 systems the uninitialized bytes the kernel cares about were always zero so everything worked as expected. PR: 197309, 199559 Submitted by: ota@j.email.ne.jp, Fabian Keil Reviewed by: pjd MFC after: 1 week Changes: head/sbin/ggate/ggatec/ggatec.c head/sbin/ggate/ggatel/ggatel.c
Fixed in HEAD, I'll MFC this in a week. Thanks!
A commit references this bug: Author: brueffer Date: Tue Jul 21 14:25:22 UTC 2015 New revision: 285748 URL: https://svnweb.freebsd.org/changeset/base/285748 Log: MFC: r285531 Unbreak ggatec and ggatel on i386 after r238119, which added two more 'struct g_gate_ctl_create' fields. While the behaviour was technically undefined on other architectures as well, on the reporter's amd64 systems the uninitialized bytes the kernel cares about were always zero so everything worked as expected. PR: 197309, 199559 Submitted by: ota@j.email.ne.jp, Fabian Keil Reviewed by: pjd Approved by: re (gjb) Changes: _U stable/10/ stable/10/sbin/ggate/ggatec/ggatec.c stable/10/sbin/ggate/ggatel/ggatel.c
Merge done; thanks again!