[Bug 211028] [GEOM][Hyper-V] gpart can't detect the new free space after the disk capacity changes
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Jul 15 15:20:14 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211028
--- Comment #18 from Andrey V. Elsukov <ae at FreeBSD.org> ---
(In reply to Dexuan Cui from comment #17)
> (In reply to Dexuan Cui from comment #16)
> Please review the attached patch. It may be a little ugly since I'm pretty
> new to GEOM code... Please suggest how we should fix the issue in a better
> way.
GEOM serves not only the disks, you can break g_provider_resize() for other
types of providers.
Can you test this patch instead?
Index: geom_disk.c
===================================================================
--- geom_disk.c (revision 302840)
+++ geom_disk.c (working copy)
@@ -126,7 +126,6 @@ g_disk_access(struct g_provider *pp, int r, int w,
if (error != 0)
return (error);
}
- pp->mediasize = dp->d_mediasize;
pp->sectorsize = dp->d_sectorsize;
if (dp->d_maxsize == 0) {
printf("WARNING: Disk drive %s%d has no d_maxsize\n",
@@ -143,6 +142,7 @@ g_disk_access(struct g_provider *pp, int r, int w,
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
+ g_resize_provider(pp, dp->d_mediasize);
} else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) {
if (dp->d_close != NULL) {
error = dp->d_close(dp);
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list