diff options
author | trasz <trasz@FreeBSD.org> | 2012-05-25 10:08:48 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2012-05-25 10:08:48 +0000 |
commit | e85afbafb3b2adb998507529a3a3d1ac6782ba18 (patch) | |
tree | 1d99faf1b438097150c9be79dd7b107104a33484 | |
parent | 2dc26af4447ddf75f00ee32933b59022bffa31a6 (diff) | |
download | FreeBSD-src-e85afbafb3b2adb998507529a3a3d1ac6782ba18.zip FreeBSD-src-e85afbafb3b2adb998507529a3a3d1ac6782ba18.tar.gz |
Revert r235918 for now and add comment explaining the reason for the
size check.
-rw-r--r-- | sys/geom/label/g_label_ufs.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c index 6035a6a..6a313e2 100644 --- a/sys/geom/label/g_label_ufs.c +++ b/sys/geom/label/g_label_ufs.c @@ -81,10 +81,16 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int wh 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); |