[stgt] Turning off write-caching

Chris Webb chris at arachsys.com
Sun Mar 22 16:34:01 CET 2009

I'm trying to disable write-caching for devices exported via iSCSI by tgtd
0.9.5. According to


I should be able to do this with

  tgtadm -L iscsi -m logicalunit -o update -t $TID -l $LUN \
         -P mode_page=8:0:18:0x10:0:0xff:0xff:0:0:0xff:0xff:0xff:0xff:0x80:0x14:0:0:0:0:0:0

(Both of the patches listed seem already to be in the newly released tgtd

However, despite having run this for the LUN concerned before logging in to
it with an initiator, I'm still getting uncached writes (far too fast for
the underlying disk) when I do an O_SYNC/O_DIRECT write to the /dev/sdX on a
remote machine. O_DIRECT/O_SYNC writes to the local block device run at the
expected speed, of course. My sequence of commands to export looks like

  tgtadm -L iscsi -m target -o new -t $TID -T $TARGET
  tgtadm -L iscsi -m logicalunit -o new -t $TID -l 1 -b $DEVICE
  tgtadm -L iscsi -m logicalunit -o update -t $TID -l 1
         -P mode_page=8:0:18:0x10:0:0xff:0xff:0:0:0xff:0xff:0xff:0xff:0x80:0x14:0:0:0:0:0:0
  tgtadm -L iscsi -m account -o bind -t $TID -u $USER
  tgtadm -L iscsi -m target -o bind -t $TID -I ALL

and everything is apparently working fine apart from the unwanted write

I'm testing using tgtd 0.9.5 with the kernel target driver from stock linux (amd64). My initiator is also linux: iscsi_tcp from Any
suggestions as to what I'm doing wrong would be greatly appreciated.

Best wishes,


To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list