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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 13 Mar 2012 19:38:18 +0800
From:	Robin Dong <hao.bigrat@...il.com>
To:	linux-ext4@...r.kernel.org
Cc:	Robin Dong <hao.bigrat@...il.com>, Robin Dong <sanbai@...bao.com>
Subject: [PATCH 3/3] ext4: modify the process of invalidate_page for the new implemention of quota reservation

Since buffer_head with PG_Delay does not means "quota already occupied" any more, we
should check whether to release reservation in ext4_da_invalidatepage.

Signed-off-by: Robin Dong <sanbai@...bao.com>
---
 fs/ext4/inode.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7e27581..e5d15eb 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1202,6 +1202,7 @@ static void ext4_da_page_release_reservation(struct page *page,
 	unsigned int curr_off = 0;
 	struct inode *inode = page->mapping->host;
 	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+	struct ext4_map_blocks map;
 	int num_clusters;
 
 	head = page_buffers(page);
@@ -1220,15 +1221,21 @@ static void ext4_da_page_release_reservation(struct page *page,
 	/* If we have released all the blocks belonging to a cluster, then we
 	 * need to release the reserved space for that cluster. */
 	num_clusters = EXT4_NUM_B2C(sbi, to_release);
-	while (num_clusters > 0) {
-		ext4_fsblk_t lblk;
-		lblk = (page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits)) +
-			((num_clusters - 1) << sbi->s_cluster_bits);
-		if (sbi->s_cluster_ratio == 1 ||
-		    !ext4_find_delalloc_cluster(inode, lblk, 1))
-			ext4_da_release_space(inode, 1);
-
-		num_clusters--;
+
+	if (sbi->s_cluster_ratio == 1)
+		ext4_da_release_space(inode, num_clusters);
+	else {
+		while (num_clusters > 0) {
+			map.m_lblk = (page->index <<
+					(PAGE_CACHE_SHIFT - inode->i_blkbits))
+				+ ((num_clusters - 1) << sbi->s_cluster_bits);
+			map.m_len = 1 << sbi->s_cluster_bits;
+			ext4_map_blocks(NULL, inode, &map, 0);
+			if (!(map.m_flags & EXT4_MAP_FROM_CLUSTER))
+				ext4_da_release_space(inode, 1);
+
+			num_clusters--;
+		}
 	}
 }
 
-- 
1.7.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ