Commit 8682164a authored by Evgeniy Dushistov's avatar Evgeniy Dushistov Committed by Linus Torvalds

[PATCH] ufs: truncate negative to unsigned fix

During ufs_trunc_direct which is subroutine of ufs::truncate, we try the first
of all free parts of block and then whole blocks.  But we calculate size of
block's part to free in the wrong way.

This may cause bad update of used blocks and fragments statistic, and you can
got report that you have free 32T on 1Gb partition.
Signed-off-by: default avatarEvgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a685e26f
...@@ -109,10 +109,10 @@ static int ufs_trunc_direct (struct inode * inode) ...@@ -109,10 +109,10 @@ static int ufs_trunc_direct (struct inode * inode)
tmp = fs32_to_cpu(sb, *p); tmp = fs32_to_cpu(sb, *p);
if (!tmp ) if (!tmp )
ufs_panic (sb, "ufs_trunc_direct", "internal error"); ufs_panic (sb, "ufs_trunc_direct", "internal error");
frag2 -= frag1;
frag1 = ufs_fragnum (frag1); frag1 = ufs_fragnum (frag1);
frag2 = ufs_fragnum (frag2);
ufs_free_fragments (inode, tmp + frag1, frag2 - frag1); ufs_free_fragments(inode, tmp + frag1, frag2);
mark_inode_dirty(inode); mark_inode_dirty(inode);
frag_to_free = tmp + frag1; frag_to_free = tmp + frag1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment