tgt doesn't export some LUNs after a reload operation (SIGHUP)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tgt (Ubuntu) |
Fix Released
|
High
|
Unassigned |
Bug Description
Sometime, after run a `reload tgt`, some LUNs aren't correctly added to the targets.
The error will be reproduced above:
$ tgt-admin --dump
default-driver iscsi
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
Now, we'll send a SIGHUP signal to tgt:
$ reload tgt
# run `kill -SIGHUP $TGT_ROOT_PID` have the same behavior
$ tgt-admin --dump
default-driver iscsi
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
<target iqn.2014-
backing-store /dev/vg_
initiator-address 192.168.130.0/24
initiator-address 127.0.0.1
</target>
Now, some target LUNs weren't correcty attached to the target (/dev/vg_
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: tgt 1:1.0.17-1ubuntu2
ProcVersionSign
Uname: Linux 3.8.0-35-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Tue Mar 18 14:57:37 2014
MarkForUpload: True
SourcePackage: tgt
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in tgt (Ubuntu): | |
importance: | Undecided → High |
I think the problem can be related to this fact: the TGT daemon don't add a block storage to a LUN if some process was accessing it.
The following command show another operation in which a similar problem occours:
# All block storage added to the targets vmware/ vmware_ 4 vmware/ vmware_ 3 vmware/ vmware_ 2 vmware/ vmware_ 1 vmware/ vmware_ 5 vg_vmware- vmware_ 1 /dev/mapper/ vg_vmware- vmware_ 2 \ vg_vmware- vmware_ 3 /dev/mapper/ vg_vmware- vmware_ 4 \ vg_vmware- vmware_ 5; start tgt; tgt-admin --dump | grep -o "backing-store \(.*\)" | \ vmware/ vmware_ 5 vg_vmware- vmware_ 1 /dev/mapper/ vg_vmware- vmware_ 2 /dev/mapper/ vg_vmware- vmware_ 3 /dev/mapper/ vg_vmware- vmware_ 4 /dev/mapper/ vg_vmware- vmware_ 5 vg_vmware- vmware_ 1 -> ../dm-0 vg_vmware- vmware_ 2 -> ../dm-2 vg_vmware- vmware_ 3 -> ../dm-3 vg_vmware- vmware_ 4 -> ../dm-4 vg_vmware- vmware_ 5 -> ../dm-5
$ tgt-admin --dump | grep -o "backing-store \(.*\)" | sed -e "s/^backing-store \(.*\)$/\1/"
/dev/vg_
/dev/vg_
/dev/vg_
/dev/vg_
/dev/vg_
# Now, we'll run a stop/start operation. Some device block (previously LUNs) still opened by some process
# between the `stop` and `start` operations. In our case, the device blocks was opened by the command `blkid`,
# running with the 'root' user.
$ stop tgt; lsof /dev/mapper/
$ /dev/mapper/
$ /dev/mapper/
$ sed -e "s/^backing-store \(.*\)$/\1/"
tgt stop/waiting
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
blkid 29870 root 3r BLK 252,2 0t212992 1585695 /dev/mapper/../dm-2
blkid 29871 root 3r BLK 252,0 0t143360 1605724 /dev/mapper/../dm-0
blkid 29872 root 3r BLK 252,3 0t180224 1585696 /dev/mapper/../dm-3
blkid 29875 root 3r BLK 252,4 0x1fd70bce200 1585697 /dev/mapper/../dm-4
tgt start/running, process 29878
/dev/vg_
$ ls -lh /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 18 15:27 /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 18 15:27 /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 18 15:27 /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 18 15:27 /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 18 15:27 /dev/mapper/
In our test, four device blocks (vg_vmware- vmware_ 1, vg_vmware-vmware_2, vg_vmware-vmware_3 and vg_vmware-vmware_4) were opened by the blkid command, and the `start tgt` command (that runs `/usr/sbin/ tgt-admin -e`) only adds the other lun (vg_vmware- vmware_ 5).
I hope this test helps.