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: <1446455015-26888-1-git-send-email-fangwei1@huawei.com>
Date:	Mon, 2 Nov 2015 17:03:35 +0800
From:	Wei Fang <fangwei1@...wei.com>
To:	<tigran@...azian.fsnet.co.uk>
CC:	<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	Wei Fang <fangwei1@...wei.com>
Subject: [PATCH] bfs: fix i_blocks accounting

Update inode->i_blocks if succeed to get block, otherwise we'll
get wrong number of blocks.

Signed-off-by: Wei Fang <fangwei1@...wei.com>
---
 fs/bfs/file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 97f1b51..f89abdb 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -108,6 +108,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 		map_bh(bh_result, sb, phys);
 		info->si_freeb -= phys - bi->i_eblock;
 		info->si_lf_eblk = bi->i_eblock = phys;
+		inode->i_blocks = block + 1;
 		mark_inode_dirty(inode);
 		err = 0;
 		goto out;
@@ -141,7 +142,8 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 	 * This assumes nothing can write the inode back while we are here
 	 * and thus update inode->i_blocks! (XXX)
 	 */
-	info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks;
+	info->si_freeb -= block + 1 - inode->i_blocks;
+	inode->i_blocks = block + 1;
 	mark_inode_dirty(inode);
 	map_bh(bh_result, sb, phys);
 out:
-- 
1.7.1

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