Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Dec 2011 21:23:03 GMT
From:      Michiel Boland <michiel@boland.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   sparc64/163460: SU+J fsck uses bogus sector size on sparc64
Message-ID:  <201112192123.pBJLN3T1097034@red.freebsd.org>
Resent-Message-ID: <201112192130.pBJLUCiT084417@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help


>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112192123.pBJLN3T1097034>