diff options
author | ae <ae@FreeBSD.org> | 2014-05-07 11:18:27 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2014-05-07 11:18:27 +0000 |
commit | 9a65da5a22dd91368d4faca1f36fe3bdbcfa556b (patch) | |
tree | 1cf67ebb05d0addffcac5c291345f57a3c15f39c /sys/geom | |
parent | 8d7e1b3f3951144fda6e97e6420388348157a4bc (diff) | |
download | FreeBSD-src-9a65da5a22dd91368d4faca1f36fe3bdbcfa556b.zip FreeBSD-src-9a65da5a22dd91368d4faca1f36fe3bdbcfa556b.tar.gz |
It is safe to allow shrinking, when aligned size is bigger than current.
Tested by: jmg
MFC after: 1 week
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/part/g_part_mbr.c | 4 | ||||
-rw-r--r-- | sys/geom/part/g_part_pc98.c | 2 | ||||
-rw-r--r-- | sys/geom/part/g_part_vtoc8.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c index f9f06be..73101ff 100644 --- a/sys/geom/part/g_part_mbr.c +++ b/sys/geom/part/g_part_mbr.c @@ -356,8 +356,8 @@ g_part_mbr_resize(struct g_part_table *basetable, return (EINVAL); /* XXX: prevent unexpected shrinking. */ pp = baseentry->gpe_pp; - if ((g_debugflags & 16) == 0 && size < gpp->gpp_size && - (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) + if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && + pp->mediasize / pp->sectorsize > size) return (EBUSY); entry = (struct g_part_mbr_entry *)baseentry; baseentry->gpe_end = baseentry->gpe_start + size - 1; diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c index b2b6e68..07d6a62 100644 --- a/sys/geom/part/g_part_pc98.c +++ b/sys/geom/part/g_part_pc98.c @@ -364,7 +364,7 @@ g_part_pc98_resize(struct g_part_table *basetable, /* XXX: prevent unexpected shrinking. */ pp = baseentry->gpe_pp; if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && - (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) + pp->mediasize / pp->sectorsize > size) return (EBUSY); entry = (struct g_part_pc98_entry *)baseentry; baseentry->gpe_end = baseentry->gpe_start + size - 1; diff --git a/sys/geom/part/g_part_vtoc8.c b/sys/geom/part/g_part_vtoc8.c index 04d90cb..514e3f7 100644 --- a/sys/geom/part/g_part_vtoc8.c +++ b/sys/geom/part/g_part_vtoc8.c @@ -371,7 +371,7 @@ g_part_vtoc8_resize(struct g_part_table *basetable, /* XXX: prevent unexpected shrinking. */ pp = entry->gpe_pp; if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && - (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) + pp->mediasize / pp->sectorsize > size) return (EBUSY); entry->gpe_end = entry->gpe_start + size - 1; be32enc(&table->vtoc.map[entry->gpe_index - 1].nblks, size); |