On Mon, Jul 28, 2008 at 7:49 PM, Mark Harvey <[EMAIL PROTECTED]> wrote: > Richard Sharpe wrote: >>> >>> From a16d368a29298170df2c21fd19d8490c248f06b1 Mon Sep 17 00:00:00 2001 >> >> From: Richard Sharpe <[EMAIL PROTECTED]> >> Date: Mon, 28 Jul 2008 14:34:12 -0700 >> Subject: [PATCH] Make changes so that VTL stuff works properly ... >> Signed-off-by: Richard Sharpe <[EMAIL PROTECTED]> >> >> 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. 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) ... _______________________________________________ Stgt-devel mailing list [email protected] https://lists.berlios.de/mailman/listinfo/stgt-devel
