]> git.hungrycats.org Git - linux/commitdiff
[PATCH] IDE disk cache flush at unopportune momemnts
authorArjan van de Ven <arjanv@redhat.com>
Thu, 6 May 2004 23:30:23 +0000 (16:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 6 May 2004 23:30:23 +0000 (16:30 -0700)
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.

drivers/ide/ide-disk.c

index 51d7465cba1ed8a54e123005b2bc686456b846e2..64f42ad0fb0c0f54b2d90f8a04d0a913657dea87 100644 (file)
@@ -1779,7 +1779,8 @@ static int ide_cacheflush_p(ide_drive_t *drive)
 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));