On Fri, Apr 19, 2013 at 06:57:05AM +0200, Otto Moerbeek wrote:
>
> This is a bug. The blocksize disklabel computes should be max 2^16.
> fsck -b is indeed a workaround. It records the fragment and blocksize
> used in the disklabel, so subsequent newfs calls (withiut -b or -f)
> will use the same parameters.
>
> -Otto
This makes sures the fragment and block size stay within bounds.
-Otto
Index: editor.c
===================================================================
RCS file: /cvs/src/sbin/disklabel/editor.c,v
retrieving revision 1.269
diff -u -p -r1.269 editor.c
--- editor.c 13 Jul 2012 16:06:42 -0000 1.269
+++ editor.c 19 Apr 2013 05:39:31 -0000
@@ -903,6 +903,8 @@ editor_add(struct disklabel *lp, char *p
fragsize *= 2;
if (new_size > 512ULL * 1024 * 1024 * 1024)
fragsize *= 2;
+ if (fragsize > MAXBSIZE / 8)
+ fragsize = MAXBSIZE / 8;
#if defined (__sparc__) && !defined(__sparc64__)
/* can't boot from > 8k boot blocks */
pp->p_fragblock =