[Stgt-devel] disabling write cache?

FUJITA Tomonori fujita.tomonori
Wed Jun 25 04:10:31 CEST 2008


On Thu, 19 Jun 2008 13:54:15 +0200
Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> Is there a way to disable write caching when using tgtd as a target?
> 
> Right now, it seems to be impossible (at least I didn't find an option 
> in documentation nor sources) and setting it on the initiator fails:
> 
> initiator# sdparm /dev/sda
>      /dev/sda: IET       VIRTUAL-DISK  0001
> Caching (SBC) mode page:
>    WCE         1  [cha: y, def:  1, sav:  1]
>    RCD         0  [cha: n, def:  0, sav:  0]
> (...)
> 
> initiator# sdparm --set WCE=0 /dev/sda
>      /dev/sda: IET       VIRTUAL-DISK  0001
> change_mode_page: failed setting page: Caching (SBC)

I've uploaded two patches:

http://stgt.berlios.de/patches/0001-iscsi-fix-sense-handling.patch
http://stgt.berlios.de/patches/0002-sbc-add-WCE-support-to-bs_rdwr.patch

With the patches, you can disable write caching in the following way:

tgtadm --lld iscsi --op update --mode logicalunit --tid 1 --lun 1 --params mode_page=8:0:18:0x10:0:0xff:0xff:0:0:0xff:0xff:0xff:0xff:0x80:0x14:0:0:0:0:0:0

Note that you need to modify tid and lun in your environment.


Shortly, I'll let you control write caching via sdparm too.



More information about the stgt mailing list