Hi!

I think the SCSI generic interface simply bypasses Linux buffer cache, while dd 
still reads from the buffer cache.

Regards,
Ulrich

>>> Sitsofe Wheeler <[email protected]> schrieb am 28.10.2013 um 15:11 in 
>>> Nachricht
<[email protected]>:
> Hi,
> 
> After issuing a WRITE SAME via sg3utils the buffer cache and the underlying
> iSCSI disk go out of sync - is this to be expected?
> 
> I'm using Fedora 18, iscsi-initiator-utils-6.2.0.872-19.fc18.x86_64,
> kernel-3.11.4-101.fc18.x86_64 . The iSCSI target is a StorMagic SvSAN.
> 
> An example of the problem is below:
> 
> # tr "\000" "\252" < /dev/zero | dd bs=512 of=/dev/sdb count=1
> 1+0 records in
> 1+0 records out
> 512 bytes (512 B) copied, 0.0697741 s, 7.3 kB/s
> 
> # dd if=/dev/sdb | hexdump -C -n 512
> 00000000  aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa  
> |................|
> *
> 00000200
> # dd if=/dev/sdb iflag=direct | hexdump -C -n 512
> 00000000  aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa  
> |................|
> *
> 00000200
> 
> # sg_write_same --num=1 -x 512 --verbose /dev/sdb
> Default data-out buffer set to 512 zeros
> # Should all zeros
> # dd if=/dev/sdb | hexdump -C -n 512
> 00000000  aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa  
> |................|
> *
> 00000200
> # dd if=/dev/sdb iflag=direct | hexdump -C -n 512
> 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
> |................|
> *
> 00000200
> # Even after using O_DIRECT buffer cache is not returning zeros
> # dd if=/dev/sdb | hexdump -C -n 512
> 00000000  aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa  
> |................|
> *
> 00000200
> # Flushing the caches and forcing things to be reread makes the correct data
> # appear
> # echo 3 > /proc/sys/vm/drop_caches; dd if=/dev/sdb | hexdump -C -n 512
> 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
> |................|
> *
> 00000200
> 
> -- 
> Sitsofe
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "open-iscsi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/open-iscsi.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to