> From: joystick <joystick@xxxxxxxxxxxxx> > > I don't really understand this disk cache thing. > Suppose a disk with write cache enabled of writeback type: Linux > receives a write completed notification (a message from the disk) when > the data has reached the cache of the disk. Correct? At that point it is > not considered an in-flight I/O anymore. Correct? > So what happens when the disk tries to write it to the platter and > discovers that there is a media error on that sector? (suppose > relocation does not happen ; maybe sectors exhausted) > Does Linux receive the write error upon the next flush it issues? So the > error is related to the flush? And what happens if Linux never issues > such flush? I'm no expert... But modern disks play a lot of games beneath the covers, including patching around bad blocks. So in most cases, if the first write shows a media error, the controller will assign a replacement sector and write the data there. Of course the risks you discuss still exist. My guess is that if people are really worried about their data, they don't use write-back caching. I notice that the startup messages of my system talk of "writethrough" caching, which (IIRC) means that the kernel isn't told that the write is complete until the controller can guarantee the data is in non-volatile memory. In the end, the biggest risk is that the entire disk will suddenly become unreadable. Dale -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html