From nobody@FreeBSD.org  Tue Mar  4 19:48:36 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 879C01065672
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Mar 2008 19:48:36 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A6708FC28
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Mar 2008 19:48:36 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m24JjajS065445
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 4 Mar 2008 19:45:36 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m24Jjas2065444;
	Tue, 4 Mar 2008 19:45:36 GMT
	(envelope-from nobody)
Message-Id: <200803041945.m24Jjas2065444@www.freebsd.org>
Date: Tue, 4 Mar 2008 19:45:36 GMT
From: Kena <kena@vodka-pomme.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [gmirror] Removing all providers create a "zombie" mirror
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121364
>Category:       kern
>Synopsis:       [gmirror] Removing all providers create a "zombie" mirror
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ae
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 04 19:50:01 UTC 2008
>Closed-Date:    Mon Nov 11 14:41:07 UTC 2013
>Last-Modified:  Mon Nov 11 14:41:07 UTC 2013
>Originator:     Kena
>Release:        7.0-STABLE
>Organization:
>Environment:
FreeBSD 7.0-STABLE #0: Sun Mar  2 19:09:20 CET 2008
   root@fungus.kalhua:/usr/obj/usr/src/sys/GENERIC
>Description:
It is not possible to re-enable or re-activate a gmirror after all its providers have been removed with "gmirror remove", possibly while the array was rebuilding.



>How-To-Repeat:
(prepare two similarly sized disks da0 and da1)

1. gmirror label test1 da0 da1
2. newfs -U mirror/test1
3. gmirror remove test1 da1
4. gmirror insert test1 da1
5. (while da1 is rebuilding:) gmirror remove test1 da0
6. gmirror remove test1 da1

(this causes a failure in the rebuild of da1)

Here the intent is to "reload" the array completely from da0, but all operations fail:

- gmirror insert test1 da0 => fails with "test1 does not exist"

- gmirror activate test1 da0 -> fails with "test1 already activated"





>Fix:


>Release-Note:
>Audit-Trail:

From: Kena <kena@vodka-pomme.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/121364: [gmirror] Removing all providers create a "zombie" mirror
Date: Tue, 4 Mar 2008 21:53:54 +0100

 Hi,
 
 additional note: after rebooting the system,
 
 after running "gmirror load" the message
 
 GEOM_MIRROR: Device "test1" is destroyed.
 
 is printed, then the system hangs.
 
 
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Wed Mar 5 02:50:55 UTC 2008 
Responsible-Changed-Why:  

Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121364 
State-Changed-From-To: open->feedback 
State-Changed-By: vwe 
State-Changed-When: Wed Mar 5 03:36:46 UTC 2008 
State-Changed-Why:  
Please provide output of `gmirror list' 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121364 

From: Kena <kena@vodka-pomme.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/121364: [gmirror] Removing all providers create a "zombie" mirror
Date: Wed, 5 Mar 2008 08:26:24 +0100

 Hi,
 
 since the two aforementioned disks (da0 and da1) are now in production  
 elsewhere, I am repeating the test with ggate. I believe the results  
 are similar as in my previous report.
 
 0. for i in 0 1; do dd if=/dev/zero of=d$i bs=1024 count=100k; ggatel  
 create d$i; done
 
 1. gmirror label -h test1 ggate0 ggate1; gmirror list
 
 Geom name: test1
 State: COMPLETE
 Components: 2
 Balance: split
 Slice: 4096
 Flags: NONE
 GenID: 0
 SyncID: 1
 ID: 538186880
 Providers:
 1. Name: mirror/test1
     Mediasize: 104857088 (100M)
     Sectorsize: 512
     Mode: r0w0e0
 Consumers:
 1. Name: ggate0
     Mediasize: 104857600 (100M)
     Sectorsize: 512
     Mode: r1w1e1
     State: ACTIVE
     Priority: 0
     Flags: NONE
     GenID: 0
     SyncID: 1
     ID: 731206240
 2. Name: ggate1
     Mediasize: 104857600 (100M)
     Sectorsize: 512
     Mode: r1w1e1
     State: ACTIVE
     Priority: 1
     Flags: NONE
     GenID: 0
     SyncID: 1
     ID: 501776423
 
 At this point dmesg reports:
 GEOM_MIRROR: Device mirror/test1 launched (2/2).
 
 2. gmirror remove test1 ggate1 ; gmirror insert test1 ggate1 ; gmirror  
 remove test1 ggate0; gmirror list
 
 (no output from gmirror list)
 
 At this point dmesg reports:
 GEOM_MIRROR: Device test1: provider ggate1 destroyed.
 GEOM_MIRROR: Device test1: rebuilding provider ggate1.
 GEOM_MIRROR: Device test1: provider ggate0 destroyed.
 GEOM_MIRROR: Device test1: provider mirror/test1 destroyed.
 GEOM_MIRROR: Device test1: rebuilding provider ggate1 stopped.
 GEOM_MIRROR: Synchronization request failed (error=6).  
 ggate1[WRITE(offset=917504, length=131072)]
 GEOM_MIRROR: Device test1: provider ggate1 disconnected.
 GEOM_MIRROR: Device test1 destroyed.
 
 
 3. (intending to "re-activate" the mirror from provider ggate0, which  
 should be "clean"):
 
 # gmirror rebuild test1 ggate0
 gmirror: No such device: test1.
 
 # gmirror activate test1 ggate0
 Cannot read metadata from ggate0: Invalid argument.
 gmirror: Not fully done.
 
 (note: gmirror label was done with -h, so I would expect that the  
 metadata is there?)
 
 4. Rebooting the system (for a fresh start), then
 
 # ggatel create d0; ggatel create d1; gmirror load
 <prompt does not return>
 
 On the console, dmesg reports:
 GEOM_MIRROR: Device test1 destroyed.
 
 
 Let me know if you need anything else.
 
 -- 
 kena
 
State-Changed-From-To: feedback->open 
State-Changed-By: vwe 
State-Changed-When: Wed May 14 21:02:05 UTC 2008 
State-Changed-Why:  

Feedback has been provided. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121364 
State-Changed-From-To: open->closed 
State-Changed-By: ae 
State-Changed-When: Mon Nov 11 14:39:41 UTC 2013 
State-Changed-Why:  
This is already fixed with r235600 and merged to stable branches. Thanks! 


Responsible-Changed-From-To: freebsd-geom->ae 
Responsible-Changed-By: ae 
Responsible-Changed-When: Mon Nov 11 14:39:41 UTC 2013 
Responsible-Changed-Why:  
Take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121364 
>Unformatted:
