aboutsummaryrefslogtreecommitdiffstats
path: root/fs/logfs/logfs.h
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-04-13 11:46:37 -0400
committerJoern Engel <joern@logfs.org>2010-04-13 11:46:37 -0400
commit032d8f7268444a0f5d4ee02d9513d682d5b8edfc (patch)
tree57cd841514abb9ffe7df7d2569513663f551f960 /fs/logfs/logfs.h
parente05c378f4973674a16d5b9636f2310cf88aca5f2 (diff)
[LogFS] Prevent memory corruption on large deletes
Removing sufficiently large files would create aliases for a large number of segments. This in turn results in a large number of journal entries and an overflow of s_je_array. Cheap fix is to add a BUG_ON, turning memory corruption into something annoying, but less dangerous. Real fix is to count the number of affected segments and prevent the problem completely. Signed-off-by: Joern Engel <joern@logfs.org>
Diffstat (limited to 'fs/logfs/logfs.h')
-rw-r--r--fs/logfs/logfs.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
index 97195b9e93a..c9929eed80b 100644
--- a/fs/logfs/logfs.h
+++ b/fs/logfs/logfs.h
@@ -257,10 +257,14 @@ struct logfs_shadow {
257 * struct shadow_tree 257 * struct shadow_tree
258 * @new: shadows where old_ofs==0, indexed by new_ofs 258 * @new: shadows where old_ofs==0, indexed by new_ofs
259 * @old: shadows where old_ofs!=0, indexed by old_ofs 259 * @old: shadows where old_ofs!=0, indexed by old_ofs
260 * @segment_map: bitfield of segments containing shadows
261 * @no_shadowed_segment: number of segments containing shadows
260 */ 262 */
261struct shadow_tree { 263struct shadow_tree {
262 struct btree_head64 new; 264 struct btree_head64 new;
263 struct btree_head64 old; 265 struct btree_head64 old;
266 struct btree_head32 segment_map;
267 int no_shadowed_segments;
264}; 268};
265 269
266struct object_alias_item { 270struct object_alias_item {
@@ -311,6 +315,8 @@ struct logfs_block_ops {
311 write_alias_t *write_one_alias); 315 write_alias_t *write_one_alias);
312}; 316};
313 317
318#define MAX_JOURNAL_ENTRIES 256
319
314struct logfs_super { 320struct logfs_super {
315 struct mtd_info *s_mtd; /* underlying device */ 321 struct mtd_info *s_mtd; /* underlying device */
316 struct block_device *s_bdev; /* underlying device */ 322 struct block_device *s_bdev; /* underlying device */
@@ -377,7 +383,7 @@ struct logfs_super {
377 u32 s_journal_ec[LOGFS_JOURNAL_SEGS]; /* journal erasecounts */ 383 u32 s_journal_ec[LOGFS_JOURNAL_SEGS]; /* journal erasecounts */
378 u64 s_last_version; 384 u64 s_last_version;
379 struct logfs_area *s_journal_area; /* open journal segment */ 385 struct logfs_area *s_journal_area; /* open journal segment */
380 __be64 s_je_array[64]; 386 __be64 s_je_array[MAX_JOURNAL_ENTRIES];
381 int s_no_je; 387 int s_no_je;
382 388
383 int s_sum_index; /* for the 12 summaries */ 389 int s_sum_index; /* for the 12 summaries */