From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 14:06:09 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D9B81065673; Wed, 10 Dec 2008 14:06:09 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1438B8FC13; Wed, 10 Dec 2008 14:06:09 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBAE692R032216; Wed, 10 Dec 2008 14:06:09 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAE69EP032215; Wed, 10 Dec 2008 14:06:09 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812101406.mBAE69EP032215@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 10 Dec 2008 14:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185859 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 14:06:09 -0000 Author: lulf Date: Wed Dec 10 14:06:08 2008 New Revision: 185859 URL: http://svn.freebsd.org/changeset/base/185859 Log: - Make it possible to detach a subdisk from a RAID5 plex as long as the plex is not dependant on the subdisk. - While here, make error messages consistent and remove stale comments. Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 13:24:38 2008 (r185858) +++ projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 14:06:08 2008 (r185859) @@ -1128,7 +1128,8 @@ gv_attach_plex(struct gv_plex *p, struct g_topology_assert(); if (p->vol_sc != NULL) { - G_VINUM_DEBUG(1, "plex %s already attached", p->name); + G_VINUM_DEBUG(1, "unable to attach %s: already attached to %s", + p->name, p->volume); return (GV_ERR_ISATTACHED); } @@ -1139,20 +1140,16 @@ gv_attach_plex(struct gv_plex *p, struct } /* Attach to volume. Make sure volume is not up and running. */ if (gv_provider_is_open(v->provider)) { - G_VINUM_DEBUG(1, "volume %s is busy, cannot attach %s", - v->name, p->name); + G_VINUM_DEBUG(1, "unable to attach %s: volume %s is busy", + p->name, v->name); return (GV_ERR_ISBUSY); } p->vol_sc = v; strlcpy(p->volume, v->name, sizeof(p->volume)); v->plexcount++; if (rename) { - /* XXX: Check if taken?. */ snprintf(p->name, sizeof(p->name), "%s.p%d", v->name, - v->plexcount - 1); - /* XXX: Rename subdisks? Original vinum does not. */ -/* LIST_FOREACH(s, &p->subdisks, in_plex) - strlcpy(s->plex, newplexname, GV_MAXPLEXNAME);*/ + v->plexcount); } LIST_INSERT_HEAD(&v->plexes, p, in_volume); @@ -1173,7 +1170,8 @@ gv_attach_sd(struct gv_sd *s, struct gv_ /* If subdisk is attached, don't do it. */ if (s->plex_sc != NULL) { - G_VINUM_DEBUG(1, "subdisk %s already attached", s->name); + G_VINUM_DEBUG(1, "unable to attach %s: already attached to %s", + s->name, s->plex); return (GV_ERR_ISATTACHED); } @@ -1199,7 +1197,7 @@ gv_attach_sd(struct gv_sd *s, struct gv_ if (rename) { snprintf(s->name, sizeof(s->name), "%s.s%d", s->plex, - p->sdcount - 1); + p->sdcount); } if (p->vol_sc != NULL) gv_update_vol_size(p->vol_sc, gv_vol_size(p->vol_sc)); @@ -1219,17 +1217,18 @@ gv_detach_plex(struct gv_plex *p, int fl v = p->vol_sc; if (v == NULL) { - G_VINUM_DEBUG(1, "plex %s already detached", p->name); + G_VINUM_DEBUG(1, "unable to detach %s: already detached", + p->name); return (0); /* Not an error. */ } /* * Only proceed if forced or volume inactive. - * XXX: Safe dropout if we're mirrored. */ if (!(flags & GV_FLAG_F) && (gv_provider_is_open(v->provider) || p->state == GV_PLEX_UP)) { - G_VINUM_DEBUG(1, "volume busy"); + G_VINUM_DEBUG(1, "unable to detach %s: volume %s is busy", + p->name, p->volume); return (GV_ERR_ISBUSY); } v->plexcount--; @@ -1253,7 +1252,8 @@ gv_detach_sd(struct gv_sd *s, int flags) p = s->plex_sc; if (p == NULL) { - G_VINUM_DEBUG(1, "subdisk %s already detached", s->name); + G_VINUM_DEBUG(1, "unable to detach %s: already detached", + s->name); return (0); /* Not an error. */ } @@ -1261,9 +1261,12 @@ gv_detach_sd(struct gv_sd *s, int flags) * Don't proceed if we're not forcing, and the plex is up, or degraded * with this subdisk up. */ - if (!(flags & GV_FLAG_F) && ((p->state != GV_PLEX_DOWN) || - ((p->state == GV_PLEX_DEGRADED) && (s->state == GV_SD_UP)))) + if (!(flags & GV_FLAG_F) && ((p->state > GV_PLEX_DEGRADED) || + ((p->state == GV_PLEX_DEGRADED) && (s->state == GV_SD_UP)))) { + G_VINUM_DEBUG(1, "unable to detach %s: plex %s is busy", + s->name, s->plex); return (GV_ERR_ISBUSY); + } LIST_REMOVE(s, in_plex); s->plex_sc = NULL;