Any intermediate driver layered between a file system driver and a removable-media device driver must set up the next-lower-level driver's I/O stack location in IRPs. From incoming IRP_MJ_READ, IRP_MJ_WRITE, and IRP_MJ_DEVICE_CONTROL requests, the intermediate driver must copy its own I/O stack location Flags into the next-lower-level driver's I/O stack location when it sets up the I/O stack location for the lower driver.
If the intermediate driver allocates new IRPs for lower-level removable-media drivers, it must set up those IRPs as follows:
For transfer requests, it must set up the thread context in each driver-allocated IRP from the value at Tail.Overlay.Thread in the original IRP.
For IRP_MJ_READ, IRP_MJ_WRITE, and IRP_MJ_DEVICE_CONTROL requests, it must copy the I/O stack location Flags from the original IRP to each driver-allocated IRP.
Otherwise, the file system can neither maintain the integrity of cached file data nor cause the user to be prompted to remount the media that holds an open file.