Date: Mon, 9 Nov 2015 09:28:35 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r290599 - stable/10/usr.sbin/makefs/ffs Message-ID: <201511090928.tA99SZVp017672@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon Nov 9 09:28:34 2015 New Revision: 290599 URL: https://svnweb.freebsd.org/changeset/base/290599 Log: MFC r266930,r289225: r266930 (by jmg): convert to using the _daddr_t types like newfs was... Put the superblock in the correct possition for UFS2... There is a bug in FFS that if we don't put it here (for UFS2), it will forcefully relocate the superblock, and I believe cause data loss.. I have a fix for that, but w/ how many releases are broken, we won't be able to switch to the better _FLOPPY (block 0) for this for a while.. r289225 (by sbruno): makefs(8) leaves sblock.fs_providersize uninitialized (zero) that can be easily checked with dumpfs(8). This may lead to other problems, f.e. geom_label kernel module sanity checks do not like zero fs_old_size value and skips such UFS1 file system while tasting (fs_old_size derives from sblock.fs_providersize). PR: 203704 Submitted by: eugen@grosbein.net Reviewed by: marcel Modified: stable/10/usr.sbin/makefs/ffs/mkfs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/makefs/ffs/mkfs.c ============================================================================== --- stable/10/usr.sbin/makefs/ffs/mkfs.c Mon Nov 9 09:24:28 2015 (r290598) +++ stable/10/usr.sbin/makefs/ffs/mkfs.c Mon Nov 9 09:28:34 2015 (r290599) @@ -248,15 +248,16 @@ ffs_mkfs(const char *fsys, const fsinfo_ exit(21); } sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize); - sblock.fs_size = fssize = dbtofsb(&sblock, fssize); + sblock.fs_size = sblock.fs_providersize = fssize = + dbtofsb(&sblock, fssize); if (Oflag <= 1) { sblock.fs_magic = FS_UFS1_MAGIC; sblock.fs_sblockloc = SBLOCK_UFS1; - sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t); + sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs1_daddr_t); sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode); sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) * - sizeof (int32_t)); + sizeof (ufs1_daddr_t)); sblock.fs_old_inodefmt = FS_44INODEFMT; sblock.fs_old_cgoffset = 0; sblock.fs_old_cgmask = 0xffffffff; @@ -272,15 +273,11 @@ ffs_mkfs(const char *fsys, const fsinfo_ sblock.fs_old_nrpos = 1; } else { sblock.fs_magic = FS_UFS2_MAGIC; -#if 0 /* XXX makefs is used for small filesystems. */ sblock.fs_sblockloc = SBLOCK_UFS2; -#else - sblock.fs_sblockloc = SBLOCK_UFS1; -#endif - sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t); + sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t); sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode); sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) * - sizeof (int64_t)); + sizeof (ufs2_daddr_t)); } sblock.fs_sblkno =
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511090928.tA99SZVp017672>