diff options
author | ae <ae@FreeBSD.org> | 2016-09-30 03:45:41 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2016-09-30 03:45:41 +0000 |
commit | 1664922b18d47041e29a69593827af673336f53b (patch) | |
tree | 22ea8f588055ccdc65d4e3e7858c1d75cb9360dd /sys/geom | |
parent | ea6ed08789ae8292a4851ab4d8c3aa9727aa42ba (diff) | |
download | FreeBSD-src-1664922b18d47041e29a69593827af673336f53b.zip FreeBSD-src-1664922b18d47041e29a69593827af673336f53b.tar.gz |
MFC r303019:
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.
MFC r303288:
Do not invoke resize method if geom is being withered.
MFC r303637:
Do not invoke resize event if initial disk size is zero. Some disks
report the size only after first opening. And due to the events are
asynchronous, some consumers can receive this event too late and
this confuses them. This partially restores previous behaviour, and
at the same time this should fix the problem, when already opened
provider loses resize event.
PR: 211028
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_disk.c | 9 | ||||
-rw-r--r-- | sys/geom/geom_subr.c | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index e4b1e14..8c3ec64 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -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,14 @@ 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; + /* + * Do not invoke resize event when initial size was zero. + * Some disks report its size only after first opening. + */ + if (pp->mediasize == 0) + pp->mediasize = dp->d_mediasize; + else + 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); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index f67b744..d0df840 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -636,7 +636,7 @@ g_resize_provider_event(void *arg, int flag) LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { gp = cp->geom; - if (gp->resize != NULL) + if ((gp->flags & G_GEOM_WITHER) == 0 && gp->resize != NULL) gp->resize(cp); } |