[Stgt-devel] [PATCH] Make changes so that VTL stuff works properly ...
Tue Jul 29 05:35:38 CEST 2008
Richard Sharpe 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
>>> 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)
>> int tgt_device_path_update(struct target *target, struct scsi_lu *lu, char
>> 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
>> 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
> All I know is that the current code segfaults when you ask for a tape
> to be loaded into the transfer station.
> It segfaults because the appropriate bs_open method has not been
> called (which initializes some lists and such).
> tgt_device_path_update calls the bs_open routine (through the dev structure) ...
The initial open should setup/initialise the backing store methods.
Once they have been initialised, this should not be required on each media load/unload. Or am I missing something here ?
i.e. The init routine(s) should be called at startup/setup time, and the open/close should be called on each media load/unload.
Maybe its the ssc is not calling the backing store init correctly at startup ?
I'm not in a position to examine the code at the moment - however I'll have a look (tomorrow) also.
Please advise if I'm way off course with this - I missed the whole core-dump email thread and need to get up to speed.
> Stgt-devel mailing list
> Stgt-devel at lists.berlios.de
More information about the stgt