NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/50070: fsck OK but mount: incorrect super block



The following reply was made to PR kern/50070; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/50070: fsck OK but mount: incorrect super block
Date: Sun, 2 Aug 2015 20:19:25 +0000

 On Sun, Aug 02, 2015 at 02:45:01PM +0000, Martin Husemann wrote:
  >  	cs = CGSIZE(&sblock);
  >  	printf("CGSIZE(fs) : %" PRIu64 "\n", cs);
 
 I make it:
   /* base cg */     (sizeof(struct cg) + sizeof(int32_t) +         180
   /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) +           4
   /* old boff */    (fs)->fs_old_cpg * sizeof(u_int16_t) +         2
   /* inode map */   howmany((ipg), NBBY) +                         2912
   /* block map */   howmany((fpg), NBBY) +                         11796
   /* if present */  ((fs)->fs_contigsumsize <= 0 ? 0 :             
   /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) +     16
   /* cluster map */ howmany(ffs_fragstoblks(fs, (fpg)), NBBY)))  + 1475
                                                                  ------
                                                                   16385
 which is one byte too large.
 
 I suspect the real problem here is this:
 
    u_int8_t cg_space[1];		/* space for cylinder group maps */
 /* actually longer */
 
 as that causes sizeof(struct cg) to be 176 instead of 168 (at least on
 a 64-bit platform) and the CGSIZE macro was probably not supposed to
 count that.
 
 (also, the fact that this padding will make the size different on
 32-bit and 64-bit machines is Bad...)
 
 Do we know if all accesses to the cylinder group data are via
 cg_space[]? If anything uses sizeof(cg) to index into the data we're
 probably in trouble.
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index