Bug 163460 - fsck(8): SU+J fsck uses bogus sector size on sparc64
Summary: fsck(8): SU+J fsck uses bogus sector size on sparc64
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.0-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Konstantin Belousov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 21:30 UTC by michiel
Modified: 2012-01-02 00:10 UTC (History)
0 users

See Also:


Attachments
file.diff (677 bytes, patch)
2011-12-19 21:30 UTC, michiel
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description michiel 2011-12-19 21:30:11 UTC
When recovering after a crash, fsck, when asked to use the journal, either consumes all memory, or crashes otherwise.

Fix: Patch attached with submission follows:
How-To-Repeat: Install fresh FreeBSD 9.0 with SU+J (the default)
Power cycle
When fsck asks to use the journal: type Y
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2011-12-20 01:44:18 UTC
Responsible Changed
From-To: freebsd-sparc64->eadler

I'll take it.
Comment 2 dfilter service freebsd_committer 2011-12-20 20:39:09 UTC
Author: kib
Date: Tue Dec 20 20:39:00 2011
New Revision: 228751
URL: http://svn.freebsd.org/changeset/base/228751

Log:
  Change the type of real_dev_bsize variable from long to u_int.
  The DIOCGSECTORSIZE takes u_int * as an argument, using long *
  causes failures on big-endian targets.
  
  Diagnosed by:	Michiel Boland <boland37 xs4all nl>
  PR:	sparc64/163460
  Tested by:	pho (x86), flo (sparc64)
  MFC after:	1 week

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/suj.c

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h	Tue Dec 20 20:37:17 2011	(r228750)
+++ head/sbin/fsck_ffs/fsck.h	Tue Dec 20 20:39:00 2011	(r228751)
@@ -268,7 +268,7 @@ char	snapname[BUFSIZ];	/* when doing sna
 char	*cdevname;		/* name of device being checked */
 long	dev_bsize;		/* computed value of DEV_BSIZE */
 long	secsize;		/* actual disk sector size */
-long	real_dev_bsize;
+u_int	real_dev_bsize;		/* actual disk sector size, not overriden */
 char	nflag;			/* assume a no response */
 char	yflag;			/* assume a yes response */
 int	bkgrdflag;		/* use a snapshot to run on an active system */

Modified: head/sbin/fsck_ffs/suj.c
==============================================================================
--- head/sbin/fsck_ffs/suj.c	Tue Dec 20 20:37:17 2011	(r228750)
+++ head/sbin/fsck_ffs/suj.c	Tue Dec 20 20:39:00 2011	(r228751)
@@ -206,7 +206,7 @@ opendisk(const char *devnam)
 	    &real_dev_bsize) == -1)
 		real_dev_bsize = secsize;
 	if (debug)
-		printf("dev_bsize %ld\n", real_dev_bsize);
+		printf("dev_bsize %u\n", real_dev_bsize);
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2011-12-21 00:57:53 UTC
Responsible Changed
From-To: eadler->kib

over to committer
Comment 4 dfilter service freebsd_committer 2012-01-02 00:05:00 UTC
Author: kib
Date: Mon Jan  2 00:04:51 2012
New Revision: 229256
URL: http://svn.freebsd.org/changeset/base/229256

Log:
  MFC r228751:
  Change the type of real_dev_bsize variable from long to u_int.
  The DIOCGSECTORSIZE takes u_int * as an argument, using long *
  causes failures on big-endian targets.
  
  PR:	sparc64/163460

Modified:
  stable/9/sbin/fsck_ffs/fsck.h
  stable/9/sbin/fsck_ffs/suj.c
Directory Properties:
  stable/9/sbin/fsck_ffs/   (props changed)

Modified: stable/9/sbin/fsck_ffs/fsck.h
==============================================================================
--- stable/9/sbin/fsck_ffs/fsck.h	Mon Jan  2 00:02:50 2012	(r229255)
+++ stable/9/sbin/fsck_ffs/fsck.h	Mon Jan  2 00:04:51 2012	(r229256)
@@ -268,7 +268,7 @@ char	snapname[BUFSIZ];	/* when doing sna
 char	*cdevname;		/* name of device being checked */
 long	dev_bsize;		/* computed value of DEV_BSIZE */
 long	secsize;		/* actual disk sector size */
-long	real_dev_bsize;
+u_int	real_dev_bsize;		/* actual disk sector size, not overriden */
 char	nflag;			/* assume a no response */
 char	yflag;			/* assume a yes response */
 int	bkgrdflag;		/* use a snapshot to run on an active system */

Modified: stable/9/sbin/fsck_ffs/suj.c
==============================================================================
--- stable/9/sbin/fsck_ffs/suj.c	Mon Jan  2 00:02:50 2012	(r229255)
+++ stable/9/sbin/fsck_ffs/suj.c	Mon Jan  2 00:04:51 2012	(r229256)
@@ -206,7 +206,7 @@ opendisk(const char *devnam)
 	    &real_dev_bsize) == -1)
 		real_dev_bsize = secsize;
 	if (debug)
-		printf("dev_bsize %ld\n", real_dev_bsize);
+		printf("dev_bsize %u\n", real_dev_bsize);
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 5 Konstantin Belousov freebsd_committer 2012-01-02 00:05:18 UTC
State Changed
From-To: open->closed

All merged.