Date: Fri, 30 Sep 2016 03:45:41 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306476 - stable/11/sys/geom Message-ID: <201609300345.u8U3jfAW037675@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Sep 30 03:45:41 2016 New Revision: 306476 URL: https://svnweb.freebsd.org/changeset/base/306476 Log: 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 Modified: stable/11/sys/geom/geom_disk.c stable/11/sys/geom/geom_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/geom_disk.c ============================================================================== --- stable/11/sys/geom/geom_disk.c Fri Sep 30 03:27:07 2016 (r306475) +++ stable/11/sys/geom/geom_disk.c Fri Sep 30 03:45:41 2016 (r306476) @@ -126,7 +126,6 @@ g_disk_access(struct g_provider *pp, int 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 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); Modified: stable/11/sys/geom/geom_subr.c ============================================================================== --- stable/11/sys/geom/geom_subr.c Fri Sep 30 03:27:07 2016 (r306475) +++ stable/11/sys/geom/geom_subr.c Fri Sep 30 03:45:41 2016 (r306476) @@ -636,7 +636,7 @@ g_resize_provider_event(void *arg, int f 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609300345.u8U3jfAW037675>