lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46262C0E.9000103@rtr.ca>
Date:	Wed, 18 Apr 2007 10:32:46 -0400
From:	Mark Lord <lkml@....ca>
To:	Tejun Heo <htejun@...il.com>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>, 7eggert@....de,
	Chuck Ebbert <cebbert@...hat.com>,
	emisca <emisca.ml@...il.com>,
	Jan Engelhardt <jengelh@...ux01.gwdg.de>,
	Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-ide@...r.kernel.org, Adrian Bunk <bunk@...sta.de>,
	Andrew Morton <akpm@...l.org>
Subject: Re: Loud "pop" coming from hard drive on reboot

Alan Cox wrote:
>
> If you see a synchronize cache succeed and you then see the drive
> shutdown succeed then you know that a sync cache can be faked as ok
> safely. Any other command in between or after and it doesn't get faked
> 
> This seems pretty easy to deal with at command issue.

Yup.  It could be as trivial as this (untested, and not as nice
as Alan's full suggestion).

Signed-off-by:  Mark Lord <mlord@...ox.com>
---
--- linux/include/linux/libata.h.orig	2007-04-18 10:30:25.000000000 -0400
+++ linux/include/linux/libata.h	2007-04-18 10:30:28.000000000 -0400
@@ -499,6 +499,7 @@
 	struct ata_ering	ering;
 	int			spdn_cnt;
 	unsigned int		horkage;	/* List of broken features */
+	int			needs_flush;	/* bool: 1==written since last flush */
 #ifdef CONFIG_SATA_ACPI
 	/* ACPI objects info */
 	acpi_handle obj_handle;
--- linux/drivers/old/libata-scsi.c	2007-04-17 22:11:12.000000000 -0400
+++ linux/drivers/ata/libata-scsi.c	2007-04-18 10:27:29.000000000 -0400
@@ -2749,18 +2749,20 @@
 			return atapi_xlat;
 
 	switch (cmd) {
-	case READ_6:
-	case READ_10:
-	case READ_16:
-
 	case WRITE_6:
 	case WRITE_10:
 	case WRITE_16:
+		dev->needs_flush = 1;
+	case READ_6:
+	case READ_10:
+	case READ_16:
 		return ata_scsi_rw_xlat;
 
 	case SYNCHRONIZE_CACHE:
-		if (ata_try_flush_cache(dev))
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
 			return ata_scsi_flush_xlat;
+			dev->needs_flush = 0;
+		}
 		break;
 
 	case VERIFY:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ