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>] [day] [month] [year] [list]
Message-Id: <200612081152.kB8BqRG1019759@shell0.pdx.osdl.net>
Date:	Fri, 08 Dec 2006 03:52:26 -0800
From:	akpm@...l.org
To:	linux-kernel@...r.kernel.org
Cc:	akpm@...l.org, balbir@...ibm.com, csturtiv@....com, daw@....com,
	guillaume.thouvenin@...l.net, jlan@....com, nagar@...son.ibm.com,
	tee@....com
Subject: [patch 04/13] io-accounting: write-cancel accounting

From: Andrew Morton <akpm@...l.org>

Account for the number of byte writes which this process caused to not happen
after all.

Cc: Jay Lan <jlan@....com>
Cc: Shailabh Nagar <nagar@...son.ibm.com>
Cc: Balbir Singh <balbir@...ibm.com>
Cc: Chris Sturtivant <csturtiv@....com>
Cc: Tony Ernst <tee@....com>
Cc: Guillaume Thouvenin <guillaume.thouvenin@...l.net>
Cc: David Wright <daw@....com>
Signed-off-by: Andrew Morton <akpm@...l.org>
---

 fs/buffer.c   |    7 ++++++-
 mm/truncate.c |    4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff -puN fs/buffer.c~io-accounting-write-cancel-accounting fs/buffer.c
--- a/fs/buffer.c~io-accounting-write-cancel-accounting
+++ a/fs/buffer.c
@@ -2823,8 +2823,13 @@ int try_to_free_buffers(struct page *pag
 		 * could encounter a non-uptodate page, which is unresolvable.
 		 * This only applies in the rare case where try_to_free_buffers
 		 * succeeds but the page is not freed.
+		 *
+		 * Also, during truncate, discard_buffer will have marked all
+		 * the page's buffers clean.  We discover that here and clean
+		 * the page also.
 		 */
-		clear_page_dirty(page);
+		if (test_clear_page_dirty(page))
+			task_io_account_cancelled_write(PAGE_CACHE_SIZE);
 	}
 out:
 	if (buffers_to_free) {
diff -puN mm/truncate.c~io-accounting-write-cancel-accounting mm/truncate.c
--- a/mm/truncate.c~io-accounting-write-cancel-accounting
+++ a/mm/truncate.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/pagevec.h>
+#include <linux/task_io_accounting_ops.h>
 #include <linux/buffer_head.h>	/* grr. try_to_release_page,
 				   do_invalidatepage */
 
@@ -69,7 +70,8 @@ truncate_complete_page(struct address_sp
 	if (PagePrivate(page))
 		do_invalidatepage(page, 0);
 
-	clear_page_dirty(page);
+	if (test_clear_page_dirty(page))
+		task_io_account_cancelled_write(PAGE_CACHE_SIZE);
 	ClearPageUptodate(page);
 	ClearPageMappedToDisk(page);
 	remove_from_page_cache(page);
_
-
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