Use g_resize_provider() to change the size of GEOM_DISK provider,

when it is being opened. This should fix the possible loss of a resize
event when disk capacity changed.

PR:		211028
Reported by:	Dexuan Cui <decui at microsoft dot com>
MFC after:	3 weeks
This commit is contained in:
Andrey V. Elsukov 2016-07-19 05:36:21 +00:00
parent ed22e564b8
commit f1ff88cf8c

View File

@ -126,7 +126,6 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
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, int e)
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);