amd64/91799: ggated core dumps on amd64 after client connection

Javier Martín Rueda jmrueda at diatel.upm.es
Sat Jan 14 11:10:08 PST 2006


>Number:         91799
>Category:       amd64
>Synopsis:       ggated core dumps on amd64 after client connection
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 14 19:10:03 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Javier Martín Rueda
>Release:        FreeBSD 6.0-RELEASE amd64
>Organization:
<organization of PR aes)> Universidad Politécnica de Madrid
>Environment:
System: FreeBSD naranja.diatel.upm.es 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Fri Jan 13 14:11:52 CET 2006 root at naranja.diatel.upm.es:/usr/src/sys/amd64/compile/SMP amd64


	
>Description:
	

On a amd64 system where a GGATE disk has been setup, ggated crashes
on the server when the client connects to it. If the server is run
with the -v option, the following message appears:

Assertion failed: ((req->r_length % conn->c_sectorsize) == 0), function disk_thr
ead, file ggated.c, line 714.

Incidentally, the client is left in such a state that you'll be forced to do a hard reset,
as the ggatec process must block something in the kernel that seems to prevent
other disk activity on it, and it is impossible to log into it, ctrl-alt-del, shutdown, etc.

>How-To-Repeat:
	

Create a basic ggated config file on the server, like this:

172.16.1.1	RW	/dev/da1s1g

Start the server executing ggated. Then start the client with
ggatec 172.16.1.1 /dev/da1s1g.

The ggated process on the server will start core dumping and restarting,
unsuccessfully. The client will hang (waiting for the server to service it).
Warning: you may leave the client in such a state that a only a hard reset
will take it out from it (no ordered shutdown will be possible).


>Fix:

	

The problem is that the ggated code uses a data type for the sector
size of the device it is serving which is inconsistent with the one used in the kernel
by the ioctl that returns the sector size. The incorrect data type happens to work for a 32 bit
system, but not for a 64 bit. To correct it, apply the following patch to the source
tree and recompile and install ggated:


--- src/sbin/ggate/shared/ggate.h.orig	Fri Jul  8 23:28:26 2005
+++ src/sbin/ggate/shared/ggate.h	Sat Jan 14 19:40:52 2006
@@ -98,7 +98,7 @@
 void	g_gate_xvlog(const char *message, va_list ap);
 void	g_gate_xlog(const char *message, ...);
 off_t	g_gate_mediasize(int fd);
-size_t	g_gate_sectorsize(int fd);
+u_int	g_gate_sectorsize(int fd);
 void	g_gate_open_device(void);
 void	g_gate_close_device(void);
 void	g_gate_ioctl(unsigned long req, void *data);
--- src/sbin/ggate/shared/ggate.c.orig	Fri Jul  8 23:28:26 2005
+++ src/sbin/ggate/shared/ggate.c	Sat Jan 14 19:40:52 2006
@@ -149,10 +149,10 @@
 	return (mediasize);
 }
 
-size_t
+u_int
 g_gate_sectorsize(int fd)
 {
-	size_t secsize;
+	u_int secsize;
 	struct stat sb;
 
 	if (fstat(fd, &sb) == -1)
--- src/sbin/ggate/ggated/ggated.c.orig	Sun Jul 10 23:10:20 2005
+++ src/sbin/ggate/ggated/ggated.c	Sat Jan 14 19:40:29 2006
@@ -60,7 +60,7 @@
 
 struct ggd_connection {
 	off_t		 c_mediasize;
-	off_t		 c_sectorsize;
+	u_int		 c_sectorsize;
 	unsigned	 c_flags;	/* flags (RO/RW) */
 	int		 c_diskfd;
 	int		 c_sendfd;
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-amd64 mailing list