On Wed, 24 Feb 2010 09:46:23 -0500 Bill Davidsen <davidsen@xxxxxxx> wrote: > > There is no question of data corruption. > > When memory changes between being written to one device and to another, this > > does not cause corruption, only inconsistency. Either the block will be > > written again consistently soon, or it will never be read. > > > > Just what is it that rewrites the data block? The user program doesn't > know it's needed, the filesystem, if any, doesn't know it's needed, and > as far as I can tell md doesn't do checksum before issuing the write and > after the last write is done. Doesn't make a copy and write from that. > So what sees that the data has changed and rewrites it? > The filesystem re-writes the block, though probably it is more accurate to say 'the page cache' rewrites the block (the page cache is essentially just a library of code that the filesystem uses). When a page is changed, its 'Dirty' flag is set. Before a page is written out, the Dirty flag is cleared. So if a page is written differently to two devices, then it must have been changed after the Dirty flag was clear, so the Dirty flag will be set, so the page cache will try to write it out again (after about 30 seconds or at unmount time). When accessing a block device directly ( > /dev/md0 ) the page cache is still used and will still write out any page that has the Dirty flag set. If you open /dev/md0 with O_DIRECT there is no page cache involved and so no setting of Dirty flags. So you could engineer a situation with O_DIRECT that writes different data to the two devices, but you would have to try fairly hard. NeilBrown -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html