summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-02-05 16:59:24 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-02-05 16:59:24 -0800
commit9a3e1a9676060802c78d70332a18da28b8e1e480 (patch)
treee4236696853b7ec0aa8655b8d31c1f34a7ba7e5b /include/linux
parent4f1cb3ff0f25323a228c77dea55ca93b8dde31d0 (diff)
[PATCH] Fix signed use of i_blocks in ext3 truncate
Patch from "Stephen C. Tweedie" <sct@redhat.com> Fix "h_buffer_credits<0" assert failure during truncate. The bug occurs when the "i_blocks" count in the file's inode overflows past 2^31. That works fine most of the time, because i_blocks is an unsigned long, and should go up to 2^32; but there's a place in truncate where ext3 calculates the size of the next transaction chunk for the delete, and that mistakenly uses a signed long instead. Because the huge i_blocks gets cast to a negative value, ext3 does not reserve enough credits for the transaction and the above error results. This is usually only possible on filesystems corrupted for other reasons, but it is reproducible if you create a single, non-sparse file larger than 1TB on ext3 and then try to delete it.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ext3_jbd.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index 13508f6053b9..7ac910d15863 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -28,7 +28,7 @@
* indirection blocks, the group and superblock summaries, and the data
* block to complete the transaction. */
-#define EXT3_SINGLEDATA_TRANS_BLOCKS 8
+#define EXT3_SINGLEDATA_TRANS_BLOCKS 8U
/* Extended attributes may touch two data buffers, two bitmap buffers,
* and two group and summaries. */
@@ -58,7 +58,7 @@ extern int ext3_writepage_trans_blocks(struct inode *inode);
* start off at the maximum transaction size and grow the transaction
* optimistically as we go. */
-#define EXT3_MAX_TRANS_DATA 64
+#define EXT3_MAX_TRANS_DATA 64U
/* We break up a large truncate or write transaction once the handle's
* buffer credits gets this low, we need either to extend the
@@ -67,7 +67,7 @@ extern int ext3_writepage_trans_blocks(struct inode *inode);
* one block, plus two quota updates. Quota allocations are not
* needed. */
-#define EXT3_RESERVE_TRANS_BLOCKS 12
+#define EXT3_RESERVE_TRANS_BLOCKS 12U
#define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8