From nsayer@quack.kfu.com  Tue Mar  3 03:45:15 2009
Return-Path: <nsayer@quack.kfu.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68E431065688
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Mar 2009 03:45:15 +0000 (UTC)
	(envelope-from nsayer@quack.kfu.com)
Received: from quack.kfu.com (6to4.kfu.com [IPv6:2002:478d:4001::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 27F088FC19
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Mar 2009 03:45:15 +0000 (UTC)
	(envelope-from nsayer@quack.kfu.com)
Received: from quack.kfu.com (localhost [127.0.0.1])
	by quack.kfu.com (8.14.3/8.14.3) with ESMTP id n233jCOE001339
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 2 Mar 2009 19:45:14 -0800 (PST)
	(envelope-from nsayer@quack.kfu.com)
Received: (from nsayer@localhost)
	by quack.kfu.com (8.14.3/8.14.3/Submit) id n233jC9g001338;
	Mon, 2 Mar 2009 19:45:12 -0800 (PST)
	(envelope-from nsayer)
Message-Id: <200903030345.n233jC9g001338@quack.kfu.com>
Date: Mon, 2 Mar 2009 19:45:12 -0800 (PST)
From: Nick Sayer <nsayer@kfu.com>
Reply-To: Nick Sayer <nsayer@kfu.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: glabel failing on journaled partition
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         132273
>Category:       kern
>Synopsis:       glabel(8): [patch] failing on journaled partition
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-geom
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 03 03:50:00 UTC 2009
>Closed-Date:    Wed May 18 16:29:21 UTC 2011
>Last-Modified:  Wed May 18 16:30:11 UTC 2011
>Originator:     Nick Sayer
>Release:        FreeBSD 7.1-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD quack.kfu.com 7.1-RELEASE-p1 FreeBSD 7.1-RELEASE-p1 #12: Fri Jan 9 12:01:41 PST 2009 root@quack.kfu.com:/usr/obj/usr/src/sys/QUACK i386


	

	disk is GPT partitioned. ad0p5 is the data provider and ad0p7
	is a 10G journal partition. The filesystem has a UFS label of
	"home". I have set the label geom debug sysctl to 2.

>Description:

The label for ufs/home is not there when the system attempts to mount
it. Dmesg says:

GEOM_LABEL[2]: Tasting ad0.
GEOM_LABEL[1]: MSDOSFS: ad0: FAT12/16 volume not valid.
GEOM_LABEL[2]: Tasting ad0p1.
GEOM_LABEL[1]: MSDOSFS: ad0p1: no FAT signature found.
GEOM_LABEL[2]: Tasting ad0p2.
GEOM_LABEL[1]: UFS2 file system detected on ad0p2.
GEOM_LABEL[0]: Label for provider ad0p2 is ufs/root.
GEOM_LABEL[1]: MSDOSFS: ad0p2: no FAT signature found.
GEOM_LABEL[2]: Tasting ad0p3.
GEOM_LABEL[1]: UFS2 file system detected on ad0p3.
GEOM_LABEL[0]: Label for provider ad0p3 is ufs/var.
GEOM_LABEL[1]: MSDOSFS: ad0p3: no FAT signature found.
GEOM_LABEL[2]: Tasting ad0p4.
GEOM_LABEL[1]: UFS2 file system detected on ad0p4.
GEOM_LABEL[0]: Label for provider ad0p4 is ufs/usr.
GEOM_LABEL[1]: MSDOSFS: ad0p4: no FAT signature found.
GEOM_LABEL[2]: Tasting ad0p5.
GEOM_LABEL[1]: UFS2 file system detected on ad0p5.
GEOM_LABEL[0]: Label for provider ad0p5 is ufs/home.
GEOM_LABEL[1]: MSDOSFS: ad0p5: no FAT signature found.
GEOM_JOURNAL: Journal 3505265168: ad0p5 contains data.
GEOM_LABEL[2]: Tasting ad0p6.
GEOM_LABEL[1]: MSDOSFS: ad0p6: no FAT signature found.
GEOM_LABEL[2]: Tasting ad0p7.
GEOM_LABEL[1]: MSDOSFS: ad0p7: no FAT signature found.
GEOM_JOURNAL: Journal 3505265168: ad0p7 contains journal.
GEOM_JOURNAL: Journal ad0p5 clean.
GEOM_LABEL[2]: Tasting ufs/root.
GEOM_LABEL[2]: Tasting ufs/var.
GEOM_LABEL[2]: Tasting ufs/usr.
GEOM_LABEL[2]: Tasting ufs/home.
GEOM_LABEL[0]: Label ufs/home removed.
GEOM_LABEL[2]: Tasting ad0p5.journal.
GEOM_LABEL[0]: Label for provider ad0p5.journal is label/home.
GEOM_LABEL[1]: UFS2 file system detected on ad0p5.journal.
GEOM_LABEL[1]: Label home(ufs/home) already exists (ad0p5.journal).
GEOM_LABEL[1]: MSDOSFS: ad0p5.journal: no FAT signature found.
GEOM_LABEL[2]: Tasting label/home.
Trying to mount root from ufs:/dev/ufs/root

Note, in particular, that when geom journal comes along, it removes the
label for ufs/home, presumably because it "takes over" ad0p5. When it
then presents ad0p5.journal to GEOM_LABEL, label complains that ufs/home
already exists (ignore the refernce to label/home - that is my current
work-around).

	
>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:

From: Nick Sayer <nsayer@kfu.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132273: glabel failing on journaled partition
Date: Tue, 3 Mar 2009 07:38:58 -0800

 I haven't yet tried this, and I am not a geom internals expert, but  
 might this be the fix?
 
 --- sys/geom/label/g_label.c.orig	2008-12-28 14:45:10.000000000 -0800
 +++ sys/geom/label/g_label.c	2009-03-03 07:36:57.000000000 -0800
 @@ -158,6 +158,8 @@
   		pp2 = LIST_FIRST(&gp->provider);
   		if (pp2 == NULL)
   			continue;
 +		if (pp2->flags & G_PF_ORPHAN)
 +			continue;
   		if (strcmp(pp2->name, name) == 0) {
   			G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
   			    label, name, pp->name);
 
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Tue Mar 3 16:12:45 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Nick Sayer <nsayer@kfu.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132273: [glabel] [patch] failing on journaled partition
Date: Tue, 3 Mar 2009 18:37:49 -0800

 So I actually modified the patch to exclude both G_PF_ORPHAN and  
 G_PF_WITHER flags from the duplicate check. That worked. I am not 100%  
 sure *which* one actually did the trick. I suspect now that it's the  
 WITHER check that actually fixed the problem, but I'll leave that to  
 the experts.
 
 But as it is now, the patch that checks both the ORPHAN and WITHER  
 flag and continues if either is set fixes my problem.
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132273: commit references a PR
Date: Wed,  4 May 2011 13:07:04 +0000 (UTC)

 Author: ae
 Date: Wed May  4 12:59:11 2011
 New Revision: 221433
 URL: http://svn.freebsd.org/changeset/base/221433
 
 Log:
   When checking existence of providers skip those which are orphaned.
   
   PR:		kern/132273
   MFC after:	2 week
 
 Modified:
   head/sys/geom/label/g_label.c
 
 Modified: head/sys/geom/label/g_label.c
 ==============================================================================
 --- head/sys/geom/label/g_label.c	Wed May  4 12:48:02 2011	(r221432)
 +++ head/sys/geom/label/g_label.c	Wed May  4 12:59:11 2011	(r221433)
 @@ -164,6 +164,8 @@ g_label_create(struct gctl_req *req, str
  		pp2 = LIST_FIRST(&gp->provider);
  		if (pp2 == NULL)
  			continue;
 +		if ((pp2->flags & G_PF_ORPHAN) != 0)
 +			continue;
  		if (strcmp(pp2->name, name) == 0) {
  			G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
  			    label, name, pp->name);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: ae 
State-Changed-When: Wed May 4 16:53:42 UTC 2011 
State-Changed-Why:  
Fixed in head/. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132273: commit references a PR
Date: Wed, 18 May 2011 16:07:43 +0000 (UTC)

 Author: ae
 Date: Wed May 18 16:07:24 2011
 New Revision: 222064
 URL: http://svn.freebsd.org/changeset/base/222064
 
 Log:
   MFC r221433:
     When checking existence of providers skip those which are orphaned.
   
     PR:		kern/132273
 
 Modified:
   stable/8/sys/geom/label/g_label.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/geom/label/g_label.c
 ==============================================================================
 --- stable/8/sys/geom/label/g_label.c	Wed May 18 16:01:29 2011	(r222063)
 +++ stable/8/sys/geom/label/g_label.c	Wed May 18 16:07:24 2011	(r222064)
 @@ -162,6 +162,8 @@ g_label_create(struct gctl_req *req, str
  		pp2 = LIST_FIRST(&gp->provider);
  		if (pp2 == NULL)
  			continue;
 +		if ((pp2->flags & G_PF_ORPHAN) != 0)
 +			continue;
  		if (strcmp(pp2->name, name) == 0) {
  			G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
  			    label, name, pp->name);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: ae 
State-Changed-When: Wed May 18 16:28:47 UTC 2011 
State-Changed-Why:  
Merged to stable/8 and stable/7. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132273: commit references a PR
Date: Wed, 18 May 2011 16:28:47 +0000 (UTC)

 Author: ae
 Date: Wed May 18 16:28:28 2011
 New Revision: 222067
 URL: http://svn.freebsd.org/changeset/base/222067
 
 Log:
   MFC r221433:
     When checking existence of providers skip those which are orphaned.
   
     PR:		kern/132273
 
 Modified:
   stable/7/sys/geom/label/g_label.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/geom/label/g_label.c
 ==============================================================================
 --- stable/7/sys/geom/label/g_label.c	Wed May 18 16:20:28 2011	(r222066)
 +++ stable/7/sys/geom/label/g_label.c	Wed May 18 16:28:28 2011	(r222067)
 @@ -161,6 +161,8 @@ g_label_create(struct gctl_req *req, str
  		pp2 = LIST_FIRST(&gp->provider);
  		if (pp2 == NULL)
  			continue;
 +		if ((pp2->flags & G_PF_ORPHAN) != 0)
 +			continue;
  		if (strcmp(pp2->name, name) == 0) {
  			G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
  			    label, name, pp->name);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
