From owner-freebsd-sparc64@FreeBSD.ORG Mon Dec 19 21:30:14 2011 Return-Path: Delivered-To: freebsd-sparc64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C64BB106567C for ; Mon, 19 Dec 2011 21:30:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D7C628FC18 for ; Mon, 19 Dec 2011 21:30:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pBJLUCFl084421 for ; Mon, 19 Dec 2011 21:30:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pBJLUCiT084417; Mon, 19 Dec 2011 21:30:12 GMT (envelope-from gnats) Resent-Date: Mon, 19 Dec 2011 21:30:12 GMT Resent-Message-Id: <201112192130.pBJLUCiT084417@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-sparc64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Michiel Boland Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32DCE106566B for ; Mon, 19 Dec 2011 21:23:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 1DF378FC0A for ; Mon, 19 Dec 2011 21:23:04 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pBJLN3LH097035 for ; Mon, 19 Dec 2011 21:23:03 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id pBJLN3T1097034; Mon, 19 Dec 2011 21:23:03 GMT (envelope-from nobody) Message-Id: <201112192123.pBJLN3T1097034@red.freebsd.org> Date: Mon, 19 Dec 2011 21:23:03 GMT From: Michiel Boland To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: sparc64/163460: SU+J fsck uses bogus sector size on sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2011 21:30:14 -0000 >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: