Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 15:20:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-geom@FreeBSD.org
Subject:   [Bug 211028] [GEOM][Hyper-V] gpart can't detect the new free space after the disk capacity changes
Message-ID:  <bug-211028-14739-TZg374RG5P@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-211028-14739@https.bugs.freebsd.org/bugzilla/>
References:  <bug-211028-14739@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211028

--- Comment #18 from Andrey V. Elsukov <ae@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 on the CC list for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211028-14739-TZg374RG5P>