Date: Fri, 25 May 2012 10:08:48 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r235989 - head/sys/geom/label Message-ID: <201205251008.q4PA8mKD004486@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Fri May 25 10:08:48 2012 New Revision: 235989 URL: http://svn.freebsd.org/changeset/base/235989 Log: Revert r235918 for now and add comment explaining the reason for the size check. Modified: head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Fri May 25 09:36:39 2012 (r235988) +++ head/sys/geom/label/g_label_ufs.c Fri May 25 10:08:48 2012 (r235989) @@ -81,10 +81,16 @@ g_label_ufs_taste_common(struct g_consum fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL); if (fs == NULL) continue; - /* Check for magic */ - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { + /* Check for magic. We also need to check if file system size is equal + * to providers size, because sysinstall(8) used to bogusly put first + * partition at offset 0 instead of 16, and glabel/ufs would find file + * system on slice instead of partition. + */ + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && + pp->mediasize / fs->fs_fsize == fs->fs_old_size) { /* Valid UFS1. */ - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && + pp->mediasize / fs->fs_fsize == fs->fs_size) { /* Valid UFS2. */ } else { g_free(fs);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205251008.q4PA8mKD004486>