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-next>] [day] [month] [year] [list]
Message-Id: <1374795726-28859-1-git-send-email-wenqing.lz@taobao.com>
Date:	Fri, 26 Jul 2013 07:42:06 +0800
From:	Zheng Liu <gnehzuil.liu@...il.com>
To:	linux-ext4@...r.kernel.org
Cc:	Jan Kara <jack@...e.cz>, Zheng Liu <wenqing.lz@...bao.com>
Subject: [PATCH v2] ext4: remove the entry from es tree when bigalloc is enabled

From: Jan Kara <jack@...e.cz>

Now in ext4_da_page_release_reservation() we remove the entry from es
tree if to_release != 0.  But there are two issues.  One is that it is
wrong when blocksize != pagesize, another is that we don't need to do
this if ->s_cluster_ratio == 1 because we will remove the entry in
ext4_truncate/ext4_punch_hole.  Here we need to do this just because
when ->s_cluster_ratio > 1 we will determine whether we can release
the reserved space according to ext4_find_delalloc_cluster().

This commit tries to fix these problems.  Now we remove the entry from
es tree only if ->s_cluster_ratio > 1.

Signed-off-by: Jan Kara <jack@...e.cz>
Signed-off-by: Zheng Liu <wenqing.lz@...bao.com>
---
v2:
 * fix a typo in comment.

 fs/ext4/inode.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ba33c67..2cc97a4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1387,7 +1387,15 @@ static void ext4_da_page_release_reservation(struct page *page,
 		curr_off = next_off;
 	} while ((bh = bh->b_this_page) != head);
 
-	if (to_release) {
+	/*
+	 * Here we need to remove the entry from es tree because when bigalloc
+	 * is enabled we need to determine whether we can release the reserved
+	 * space according to the result of ext4_find_delalloc_cluster().
+	 *
+	 * If bigalloc is disabled, we don't need to do this here because these
+	 * entries in es tree will be removed in ext4_truncate/ext4_punch_hole.
+	 */
+	if (sbi->s_cluster_ratio > 1 && to_release) {
 		lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
 		ext4_es_remove_extent(inode, lblk, to_release);
 	}
-- 
1.7.9.7

--
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