Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jan 2010 23:58:52 +0100
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        freebsd-geom@freebsd.org
Cc:        freebsd-rc@FreeBSD.org
Subject:   ordering problem with gjournal and iSCSI initiator
Message-ID:  <4B5CD0AC.7090302@quip.cz>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090909040006080506080000
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I don't know what mailing list is better for this problem, so I post to 
both.

I have server with local partition using gjournal (mfid0s2f.journal).
It is mounted from fstab by this line:

/dev/mfid0s2f.journal   /vol0  ufs    rw,async,nosuid,noexec,noatime  2    2

Then I have storage connected by iSCSI initiator by attached rc script.
It should be mounted by this script according to fstab.iscsi line:

/dev/da0p1.journal     /vol1   ufs    rw,async,nosuid,noexec,noatime  2    2

But there is a problem, both partitions are journaled and journal is on 
local disk.

It means that only the first partition is checked and mounted at boot time.

GEOM_JOURNAL: Journal 2395012627: mfid0s2d contains journal.
GEOM_JOURNAL: Journal 1544711416: mfid0s2e contains journal.
GEOM_JOURNAL: Journal 2395012627: mfid0s2f contains data.
GEOM_JOURNAL: Journal mfid0s2f clean.
GEOM_JOURNAL: BIO_FLUSH not supported by mfid0s2d.
GEOM_JOURNAL: BIO_FLUSH not supported by mfid0s2f.
Root mount waiting for: GJOURNAL
Root mount waiting for: GJOURNAL
Root mount waiting for: GJOURNAL
Root mount waiting for: GJOURNAL
Root mount waiting for: GJOURNAL
GEOM_JOURNAL: Timeout. Journal gjournal 1544711416 cannot be completed.

This is because second data provider is not available at this time. 
rc.d/iscsi is executed later. (after NETWORKING, SERVERS, before DAEMON)

But da0p1.journal is not created later (after iscsi created /dev/da0) 
with this message:
GEOM_JOURNAL: Journal 1544711416: da0p1 contains data.
GEOM_JOURNAL: Timeout. Journal gjournal 1544711416 cannot be completed.

And that's why /vol1 can't be mounted by rc.d/iscsi.

My question is: Is there any "Right Way" to handle this case?

How can I "create" da0p1.journal later and complete the gjournal + mount?

The device da0p1.journal is only created if I manually do:
unmount /vol0
gjournal stop mfid0s2f.journal
kldunload geom_journal
kldload geom_journal

Then there are both entries created:
/dev/mfid0s2f.journal
/dev/da0p1.journal

And both can be manualy mounted

Miroslav Lachman

--------------090909040006080506080000
Content-Type: text/plain;
 name="iscsi.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="iscsi.txt"

#!/bin/sh

# PROVIDE: iscsi
# REQUIRE: NETWORKING
# BEFORE:  DAEMON
# KEYWORD: nojail shutdown

#
# Add the following lines to /etc/rc.conf to enable iscsi:
#
# iscsi_enable="YES"
# iscsi_fstab="/etc/fstab.iscsi"

. /etc/rc.subr

name=iscsi
rcvar=`set_rcvar`

command=/sbin/iscontrol

iscsi_enable=${iscsi_enable:-"NO"}
iscsi_fstab=${iscsi_fstab:-"/etc/fstab.iscsi"}
iscsi_exports=${iscsi_exports:-"/etc/exports.iscsi"}
iscsi_debug=${iscsi_debug:-0}
start_cmd="iscsi_start"
faststop_cmp="iscsi_stop"
stop_cmd="iscsi_stop"

iscsi_wait()
{
	dev=$1
	trap "echo 'wait loop cancelled'; exit 1" 2
	count=0
	while true; do
		if [ -c $dev ]; then
			break;
		fi
		if [ $count -eq 0 ]; then
			echo -n Waiting for ${dev}': '
		fi
		count=$((${count} + 1))
		if [ $count -eq 6 ]; then
			echo " Failed for dev=$dev"
			return 0
			break
		fi
		echo -n '.'
		sleep 5;
	done
	echo "$dev ok."
	return 1
}

iscsi_start()
{
	#
	# load needed modules
	for m in iscsi_initiator geom_label; do
		kldstat -qm $m || kldload $m
	done

	sysctl debug.iscsi_initiator=$iscsi_debug
	#
	# start iscontrol for each target
	if [ -n "${iscsi_targets}" ]; then
		for target in ${iscsi_targets}; do
			${command} ${rc_flags} -n ${target}
		done
	fi

	if [ -f "${iscsi_fstab}" ]; then
		while read spec file type opt t1 t2
		do
			case ${spec} in
			\#*|'')
			;;
			*)
				if iscsi_wait ${spec}; then
				break;
			fi
			echo type=$type spec=$spec file=$file
			fsck -p ${spec} && mkdir -p ${file} && mount ${spec} ${file}
			chmod 755 ${file} 
			;;
			esac
		done < ${iscsi_fstab} 
	fi

	if [ -f "${iscsi_exports}" ]; then
		cat ${iscsi_exports} >> /etc/exports
		#/etc/rc.d/mountd reload
		kill -1 `cat /var/run/mountd.pid`
	fi
}

iscsi_stop()
{
	echo 'iscsi stopping'
	while read spec file type opt t1 t2
	do
		case ${spec} in
		\#*|'')
		;;
		*)
			echo iscsi: umount $spec
			umount -fv $spec
		;;
		esac
	 done < ${iscsi_fstab} 
}

load_rc_config $name
run_rc_command "$1"

--------------090909040006080506080000--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B5CD0AC.7090302>