svn commit: r303637 - head/sys/geom
Andrey V. Elsukov
ae at FreeBSD.org
Mon Aug 1 20:54:55 UTC 2016
Author: ae
Date: Mon Aug 1 20:54:54 2016
New Revision: 303637
URL: https://svnweb.freebsd.org/changeset/base/303637
Log:
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
MFC after: 3 weeks
Modified:
head/sys/geom/geom_disk.c
Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c Mon Aug 1 20:29:09 2016 (r303636)
+++ head/sys/geom/geom_disk.c Mon Aug 1 20:54:54 2016 (r303637)
@@ -142,7 +142,14 @@ g_disk_access(struct g_provider *pp, int
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
- g_resize_provider(pp, dp->d_mediasize);
+ /*
+ * 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);
More information about the svn-src-head
mailing list