sparc64/163460: SU+J fsck uses bogus sector size on sparc64

Michiel Boland michiel at boland.org
Mon Dec 19 21:30:14 UTC 2011


>Number:         163460
>Category:       sparc64
>Synopsis:       SU+J fsck uses bogus sector size on sparc64
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-sparc64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 19 21:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Michiel Boland
>Release:        FreeBSD 9.0-PRERELEASE sparc64
>Organization:
>Environment:
System: FreeBSD doctorwu 9.0-PRERELEASE FreeBSD 9.0-PRERELEASE #0: Mon Dec 19 15:46:47 CET 2011 root at doctorwu:/usr/obj/usr/src/sys/DOCTORWU sparc64

>Description:
When recovering after a crash, fsck, when asked to use the journal, either consumes all memory, or crashes otherwise.

>How-To-Repeat:
Install fresh FreeBSD 9.0 with SU+J (the default)
Power cycle
When fsck asks to use the journal: type Y

>Fix:


Patch attached with submission follows:

--- sbin/fsck_ffs/suj.c.orig	2011-09-23 02:51:37.000000000 +0200
+++ sbin/fsck_ffs/suj.c	2011-12-19 22:06:03.000000000 +0100
@@ -192,6 +192,8 @@
 static void
 opendisk(const char *devnam)
 {
+	u_int s;
+
 	if (disk != NULL)
 		return;
 	disk = malloc(sizeof(*disk));
@@ -202,9 +204,13 @@
 		    disk->d_error);
 	}
 	fs = &disk->d_fs;
-	if (real_dev_bsize == 0 && ioctl(disk->d_fd, DIOCGSECTORSIZE,
-	    &real_dev_bsize) == -1)
-		real_dev_bsize = secsize;
+	if (real_dev_bsize == 0) {
+		s = 0;
+		if (ioctl(disk->d_fd, DIOCGSECTORSIZE, &s) == -1)
+			real_dev_bsize = secsize;
+		else
+			real_dev_bsize = s;
+	}
 	if (debug)
 		printf("dev_bsize %ld\n", real_dev_bsize);
 }


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-sparc64 mailing list