On Thu, 19 Aug 2010, Murphy, Robert wrote: > We are using the file backed storage gadget as the basis of a software mechanism for allowing inter-device communication between a Windows host and Linux client device. Recently we have become concerned regarding the notice of possible stability issues with the host OS if the backing file changes without the host OS having made the change (see section "AN IMPORTANT WARNING"): > http://www.linux-usb.org/gadget/file_storage.html > > So far, we have not experienced any issues with having our Linux client device changing the contents of a file in the backing file. You have been lucky. > Is there any additional documentation in regards to this warning on the page above? Does it matter if just a single file in the backing file is being changed? Could the warning be more in regards of changing the FAT table in the backing file while the host OS is accessing the storage? > > Any information on this topic would be greatly appreciated. There is no more documentation. However the problem should be quite obvious. Normally the host system will have a page cache, and pages from the slave's backing file will be stored in the host's page cache. If software on the slave changes the contents of those pages in the backing file without the host's knowledge, the page cache won't match the actual data stored on the slave. Then either of two things could happen: The host could flush its page cache. The data will remain as it is, and the next time the host accesses that page it will see the new data. This might or might not cause a problem, depending on how important the old data was to the host. The host could make its own change to that page. It would then write back its own version of the page, using the data stored in the page cache, thereby overwriting the data stored by the slave software. While this won't affect the host, it might be bad for the slave. It's impossible to be much more specific than this. The outcome depends too much on the details of what the host and the slave do. For example, if the slave deletes a file while the host is writing to it, the FAT is likely to get corrupted. Suppose the host stores a bank account number in a file on the gadget and the slave overwrites that file. The bank account number would then be lost, which seems like a pretty bad outcome. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html