LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/3] ufs: truncate negative to unsigned fix
@ 2007-01-22 15:05 Evgeniy Dushistov
  0 siblings, 0 replies; only message in thread
From: Evgeniy Dushistov @ 2007-01-22 15:05 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel; +Cc: Andrew Morton


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: Evgeniy Dushistov <dushistov@mail.ru>

---

Index: linux-2.6.20-rc5/fs/ufs/truncate.c
===================================================================
--- linux-2.6.20-rc5.orig/fs/ufs/truncate.c
+++ linux-2.6.20-rc5/fs/ufs/truncate.c
@@ -109,10 +109,10 @@ static int ufs_trunc_direct (struct inod
 	tmp = fs32_to_cpu(sb, *p);
 	if (!tmp )
 		ufs_panic (sb, "ufs_trunc_direct", "internal error");
+	frag2 -= 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);
 	frag_to_free = tmp + frag1;
 
-- 
/Evgeniy


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-22 15:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-22 15:05 [PATCH 2/3] ufs: truncate negative to unsigned fix Evgeniy Dushistov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).