[Stgt-devel] [PATCH] Make changes so that VTL stuff works properly ...

Richard Sharpe realrichardsharpe
Tue Jul 29 07:28:30 CEST 2008


On Mon, Jul 28, 2008 at 10:24 PM, FUJITA Tomonori
<fujita.tomonori at lab.ntt.co.jp> wrote:
> On Mon, 28 Jul 2008 20:58:42 -0700
> "Richard Sharpe" <realrichardsharpe at gmail.com> wrote:
>
>> On Mon, Jul 28, 2008 at 8:50 PM, FUJITA Tomonori
>> <fujita.tomonori at lab.ntt.co.jp> wrote:
>> > On Mon, 28 Jul 2008 20:09:34 -0700
>> > "Richard Sharpe" <realrichardsharpe at gmail.com> wrote:
>> >
>> >> On Mon, Jul 28, 2008 at 7:49 PM, Mark Harvey <markh794 at gmail.com> wrote:
>> >> > Richard Sharpe wrote:
>> >> >>>
>> >> >>> From a16d368a29298170df2c21fd19d8490c248f06b1 Mon Sep 17 00:00:00 2001
>> >> >>
>> >> >> From: Richard Sharpe <realrichardsharpe at gmail.com>
>> >> >> Date: Mon, 28 Jul 2008 14:34:12 -0700
>> >> >> Subject: [PATCH] Make changes so that VTL stuff works properly ...
>> >> >> Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>
>> >> >>
>> >> >> There are three changes here.
>> >> >>
>> >> >> In target.h I expose device_lookup for use by the smc.c code.
>> >> >>
>> >> >> In target.h I modify tgt_device_path_update so that we can call it to
>> >> >> both open and close a file that has been allocated to a
>> >> >> data_transfer_station.
>> >> >>
>> >> >> In smc.c I modified set_slot_full and set_slot_empty to call the
>> >> >> modified tgt_device_path_update to achieve my goals. We call
>> >> >> device_lookup to figure out the device we are interested in.
>> >> >>
>> >> >> I have tested this by loading and unloading tapes and DVDs, doing tar
>> >> >> to the drive and using cdrecord on the device, and verifying with lsof
>> >> >> that the tgtd has the files open when they are in the transfer station
>> >> >> and does not have them open when the station has been unloaded.
>> >> >>
>> >> >> It all seems to work. I have attached the patch as well because gmail
>> >> >> seems to kill patches ... I hope the attached patch is OK.
>> >> >
>> >> > Sorry, I don't quite understand the reason for this patch.
>> >> >
>> >> > The smc already calls a non-static dtd_load_unload() which performs a
>> >> > similar function to tgt_device_path_update() but with different args.
>> >> >
>> >> > int dtd_load_unload(int tid, uint64_t lun, int load, char *file)
>> >> > vs
>> >> > int tgt_device_path_update(struct target *target, struct scsi_lu *lu, char
>> >> > *path)
>> >> >
>> >> > i.e. dtd_load_unload calls __device_lookup() and then opens/closes the
>> >> > backing store.
>> >> >
>> >> > All this patch seems to do is call the 'open' or 'close' backing store
>> >> > twice.
>> >> >
>> >> >
>> >> > Perhaps 'fixing' dtd_load_unload() so it then calls tgt_device_path_update()
>> >> > if this function is not correct.
>> >> >
>> >> > FWIW: dtd_load_unload == Data Transfer Device load/unload
>> >> >
>> >> > At the time this function was added, the tgt_device_path_update() did not
>> >> > exist.
>> >>
>> >> All I know is that the current code segfaults when you ask for a tape
>> >> to be loaded into the transfer station.
>> >
>> > Can you tell me what commands you performs? I want to reproduce the
>> > ssc segfault to see what's wrong.
>>
>> I sent out a set of commands that I use to setup SMC/MMC for testing.
>> There is one mistake in the set of commands (wrong target number in
>> one place) but the same problem occurs with SMC/MMC.
>>
>> I can't send you the tape stuff until tomorrow when I am back in the office.
>
> I see. Can you send both to the mailing list?

Here's on. mmc has problems with this. I will send the tape config tomorrow.

# Create a DVD target ...
./usr/tgtadm --lld iscsi --op new    --mode target      --tid 2 -T iqn.2008-03.c
om.datalane-inc:storage.dvd1.tyan1U00.sys1

# Now the DVD drive
./usr/tgtadm --lld iscsi --op new    --mode logicalunit --tid 2 --lun 1 -Y cd
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 1 --params
 vendor_id=STGT_DVD,product_id=DVD101,product_rev=0010,scsi_sn=STGTDVD01,removab
le=1

./usr/tgtadm --lld iscsi --op new    --mode logicalunit --tid 2 --lun 2 -b /mnt/
testing/virtual-tapes/smc --device-type=changer
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 vendor_id=STK,product_id=L700,product_rev=0010,scsi_sn=STK0101,removable=1

# A data transfer unit ...
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=4,start_address=1,quantity=1

./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=4,address=1,tid=2,lun=1

./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=1,start_address=16,quantity=1

./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 media_home=/mnt/testing/virtual-tapes

./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=2,start_address=1024,quantity=8

./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=2,address=1024,barcode=DVD00,sides=1
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=2,address=1025,barcode=DVD01,sides=1
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=2,address=1026,barcode=DVD02,sides=1
./usr/tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 2 --params
 element_type=2,address=1027,barcode=DVD03,sides=1

./usr/tgtadm --lld iscsi --op bind   --mode target      --tid 2 -I ALL
./usr/tgtadm --lld iscsi --mode target --op show



More information about the stgt mailing list