Subject: bin/36351: iscsi-target can reference the wrong file for a target
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Brad Spencer <brad@anduin.eldar.org>
List: netbsd-bugs
Date: 05/16/2007 15:50:00
>Number:         36351
>Category:       bin
>Synopsis:       iscsi-target can reference the wrong file for a target
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 16 15:50:00 +0000 2007
>Originator:     Brad Spencer
>Release:        NetBSD 4.0_BETA2
>Organization:
	Home
>Environment:
System: NetBSD anduin.eldar.org 4.0_BETA2 NetBSD 4.0_BETA2 (ANDUIN) #9: Thu Feb 1 16:07:22 EST 2007 root@andor.ppn.eldar.org:/sys/arch/amd64/compile/ANDUIN amd64
Architecture: x86_64
Machine: amd64
>Description:
iscsi-target appears to reference the first file for the first extent
for all extents defined in /etc/iscsi/targets.  The effect of this is
that it is not actually possible to present more then one piece of
unique storage.

>How-To-Repeat:

Given a /etc/iscsi/targets that looks something like this:

# extent	file or device			start		length
extent0		/export/iscsi/t-one		0		7MB
extent1		/export/iscsi/t-two		0		5MB

# devices
device0 RAID0 extent0
device1 RAID0 extent1

# target	flags	storage		netmask
target0		rw	device0		10.1.0.20/32
target1		rw	device1		10.1.0.20/32

Enable iscsi_target in /etc/rc.conf.  Start the target server.  The
following is printed:

# ./iscsi_target start
Starting iscsi_target.
Reading configuration from `/etc/iscsi/targets'
target0:rw:10.1.0.20/32
        device0:RAID0
                extent0:/export/iscsi/t-one:0:7340032
target1:rw:10.1.0.20/32
        device1:RAID0
                extent1:/export/iscsi/t-two:0:5242880
DISK: 1 logical unit (14336 blocks, 512 bytes/block), type iscsi fs
DISK: LUN 0: 7 MB disk storage for "target0"
DISK: 1 logical unit (10240 blocks, 512 bytes/block), type iscsi fs
DISK: LUN 0: 5 MB disk storage for "target1"
TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target



Attach to the server using Microsoft iSCSI Initiator 2.04 from the
proper client.  Two targets will be available.

1) Log into target0.  Initialize, format, etc.. the storage using Disk
Manager.  Everything will seem fine.

2) Put a test file onto the new file system.

3) Log out of target0.

4) Log into target1.  Disk Manager will state that the storage is
already initialized and has a file system.  This shouldn't be given
that the "disk" should be blank.

5) Navigate to the filesystem and note that your test file exists there.


>Fix:

Unknown.  It appears that the target server points all targets to the
storage for the first extent.  This problem will exist if you try to
use two different clients.

I did a partial install from -current of the iscsi target and the
problem exists there, as well as my slightly older install.