From nobody@FreeBSD.org  Wed Jun 25 06:17:53 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 10ED21065674
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Jun 2008 06:17:53 +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 0BDBC8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Jun 2008 06:17:53 +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 m5P6HqT9024049
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Jun 2008 06:17:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m5P6HqjI024048;
	Wed, 25 Jun 2008 06:17:52 GMT
	(envelope-from nobody)
Message-Id: <200806250617.m5P6HqjI024048@www.freebsd.org>
Date: Wed, 25 Jun 2008 06:17:52 GMT
From: Alexei Volkov <Alexei.Volkov@softlynx.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: boot order affects geom_journal consumers selection
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         124973
>Category:       kern
>Synopsis:       [gjournal] [patch] boot order affects geom_journal consumers selection
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-geom
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 25 06:20:00 UTC 2008
>Closed-Date:    
>Last-Modified:  Sat Oct 25 18:00:07 UTC 2008
>Originator:     Alexei Volkov
>Release:        osrelease: 7.0-STABLE osreldate: 700108
>Organization:
softlynx
>Environment:
FreeBSD testhost 7.0-STABLE FreeBSD 7.0-STABLE #0: Mon May 26 12:44:12 UTC 2008     root@builder:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
The system has hardware RAID controller:

atapci0@pci0:1:2:0:     class=0x010485 card=0x341b8086 chip=0x7275105a rev=0x01 hdr=0x00
    vendor     = 'Promise Technology Inc'
    device     = 'PDC20277 FastTrak TX/SBFastTrak133 Lite EIDE Controller'
    class      = mass storage
    subclass   = RAID


This controller configured as
# atacontrol status ar0
ar0: ATA RAID1 status: READY
 subdisks:
   0 ad4  ONLINE
   1 ad6  ONLINE

ar0 labeled as 
# ls -l /dev/ar0*
crw-r-----  1 root  operator    0,  83 Jun 25 09:22 /dev/ar0
crw-r-----  1 root  operator    0,  86 Jun 25 09:22 /dev/ar0s1
crw-r-----  1 root  operator    0,  99 Jun 25 13:22 /dev/ar0s1a
crw-r-----  1 root  operator    0, 100 Jun 25 09:22 /dev/ar0s1b
crw-r-----  1 root  operator    0, 101 Jun 25 09:22 /dev/ar0s1c
crw-r-----  1 root  operator    0, 102 Jun 25 09:22 /dev/ar0s1d
crw-r-----  1 root  operator    0, 103 Jun 25 09:22 /dev/ar0s1e
crw-r-----  1 root  operator    0, 104 Jun 25 09:22 /dev/ar0s1f

And gjournal provider was configured with
# gjournal label /dev/ar0s1d
# gjournal label /dev/ar0s1e
# gjournal label /dev/ar0s1f

with subsequent
#newfs -J /dev/ar0s1d.journal
#newfs -J /dev/ar0s1e.journal
#newfs -J /dev/ar0s1f.journal

and the /boot/loader.conf has the line
geom_journal_load="YES"

/etc/fstab as followed:

/dev/ar0s1a             /               ufs     rw              1       1
/dev/ar0s1b             none            swap    sw              0       0
/dev/ar0s1d.journal     /var            ufs     rw              2       2
/dev/ar0s1e.journal     /tmp            ufs     rw              2       2
/dev/ar0s1f.journal     /usr            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0

rebooting is failed due gjournal starts using ad4* as consumers instead ar0* devices.

If the geom_journal.ko module loaded not via /boot/loader.conf but from rc.d scripts it consumes right ar0* devices.



>How-To-Repeat:
Use livefs installation. Manually label file systems as described in full description, install the system and reboot.
>Fix:
Use special /etc/rc.d/gjournal script instead /boot/loader.conf line.

#!/bin/sh
#
# /etc/rc.d/gjournal 
#

# PROVIDE: gjournal
# REQUIRE: localswap
# BEFORE: fsck mountcritlocal
# KEYWORD: nojail

. /etc/rc.subr

name="gjournal"
start_cmd="gjournal_start"
stop_cmd=":"

gjournal_start()
{
        echo  'Starting gjournal providers.'
        /sbin/gjournal load
}

load_rc_config $name
run_rc_command "$1"


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Wed Jun 25 13:08:18 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer(s).  Although there is a patch in the PR, I think 
it is more of a workaround than the actual fix, so passing it to 
-geom rather than -rc. 

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

From: Aragon Gouveia <aragon@phat.za.net>
To: bug-followup@FreeBSD.org, Alexei.Volkov@softlynx.ru
Cc:  
Subject: Re: kern/124973: [gjournal] [patch] boot order affects geom_journal consumers selection
Date: Sat, 25 Oct 2008 19:33:29 +0200

 Hi there,
 
 I just hit my head against this tonight on 7.1-BETA2.  My filesystems were
 using ad0s1a, etc. before enabling gjournal.  After creating a provider and
 enabling gjournal in loader.conf, all the filesystem device nodes got
 renamed to ad0a, etc.
 
 I'm not sure if this has been fixed since Alexei filed it or if what I'm
 describing is that fix, but all I did to fix things for me was to recreate
 my gjournal provider with the '-h' argument:
 
 gjournal label -h /dev/ad0s1g
 
 And now everything behaves when gjournal is enabled in loader.conf. :)
 
 
 Regards,
 Aragon
>Unformatted:
