[Stgt-devel] Multiple tgtd exporting same device.

Simone Gotti simone.gotti
Thu Jun 26 23:13:27 CEST 2008

Hi all,

to increase the availability (and also to use in future some features
like cluster mirror with RedHat Cluster Suite when it'll be available on
RHEL5 or in the upstream kernel) of a iscsi target server I'd like to
export the same block devices from 2 or more machines ?(connected to a
common storage). Then the iscsi initiators on other client machines will
use dm-multipath di balance I/O and to survive the lost of one or more
scsi target machines.

I'm already doing something similar with gnbd and now I'd like to do the
same with stgt via iscsi.

I was supposing that the tgtd of all the machines, to avoid data
corruption, should not use the kernel page cache (this is done by gnbd
opening the device with O_DIRECT). 

As I'm doing my tests with a RHEL5 that doesn't support AIO (which is
using O_DIRECT but from here
looks like only because this is forced) I'm using the default backing
store (bs_rdwr) that doesn't open the device with O_DIRECT and after
some tests (killing and restarting tgtd on one of the 2 target machines
in my tests with multipath was correctly working) I noticed the expected
data curruption.

After changing bs_rdrw.c to use also the O_DIRECT flag in "bs_rdwr_open"
this corruption didn't happened anymore.

Am I missing something or this should really work as I'm expecting and
noticing with my little tests?
So, do you think that should be possibile to add an option to let the
user disable the kernel page cache (enabling O_DIRECT in the various
backing stores, if this is the right way?)


Simone Gotti

More information about the stgt mailing list