summaryrefslogtreecommitdiffstats
path: root/sys/geom/label
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-02-18 03:00:49 +0000
committerpjd <pjd@FreeBSD.org>2006-02-18 03:00:49 +0000
commit14c2a07e91625a6c621365d23010a9c17236d39c (patch)
tree56b1337db062263c4406eef5cac70a2753647236 /sys/geom/label
parent401be10f03a0b999eee8e646403af6b3d38b9c5b (diff)
downloadFreeBSD-src-14c2a07e91625a6c621365d23010a9c17236d39c.zip
FreeBSD-src-14c2a07e91625a6c621365d23010a9c17236d39c.tar.gz
If provider's sector size prevents reading SBLOCKSIZE bytes return
immediatelly.
Diffstat (limited to 'sys/geom/label')
-rw-r--r--sys/geom/label/g_label_ufs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c
index 02e9761..d537293 100644
--- a/sys/geom/label/g_label_ufs.c
+++ b/sys/geom/label/g_label_ufs.c
@@ -52,6 +52,10 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size)
g_topology_assert_not();
pp = cp->provider;
label[0] = '\0';
+
+ if (SBLOCKSIZE % cp->provider->sectorsize != 0)
+ return (0);
+
/*
* Walk through the standard places that superblocks hide and look
* for UFS magic. If we find magic, then check that the size in the
@@ -61,17 +65,15 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size)
*/
for (sb = 0; (superblock = superblocks[sb]) != -1; sb++) {
/*
- * Take care not to issue an invalid I/O request. The
- * offset and size of the superblock candidate must be
- * multiples of the provider's sector size, otherwise an
- * FFS can't exist on the provider anyway.
+ * Take care not to issue an invalid I/O request. The offset of
+ * the superblock candidate must be multiples of the provider's
+ * sector size, otherwise an FFS can't exist on the provider
+ * anyway.
*/
- if (superblock % cp->provider->sectorsize != 0 ||
- SBLOCKSIZE % cp->provider->sectorsize != 0)
+ if (superblock % cp->provider->sectorsize != 0)
continue;
- fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE,
- NULL);
+ fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL);
if (fs == NULL)
continue;
/* Check for magic and make sure things are the right size */
OpenPOWER on IntegriCloud