This makes the idedisk_release function only flush the cache on final
release; with the recent 2.6 blocklayer updates release gets called
somewhat frequently, and at times where IO is outstanding to the disk.
This bug didn't trigger before simply because ide_cacheflush_p() always
was a nop.
static int idedisk_release(struct inode *inode, struct file *filp)
{
ide_drive_t *drive = inode->i_bdev->bd_disk->private_data;
- ide_cacheflush_p(drive);
+ if (drive->usage == 1)
+ ide_cacheflush_p(drive);
if (drive->removable && drive->usage == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));