From a403903602edb1b222ed1cbf353d02a4e35aa60c Mon Sep 17 00:00:00 2001 From: kalpak Date: Sat, 19 Jul 2008 13:49:08 +0000 Subject: [PATCH] b=16226 (patch by bzzz) i=johann i=kalpak if we fail to insert extent then free the blocks --- lustre/lvfs/fsfilt_ext3.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 192840f..fbbd415 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -950,9 +950,13 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, nex.ee_len = count; err = ext3_ext_insert_extent(handle, base, path, &nex); if (err) { - CERROR("can't insert extent: %d\n", err); - /* XXX: export ext3_free_blocks() */ - /*ext3_free_blocks(handle, inode, nex.ee_start, nex.ee_len, 0);*/ + /* free data blocks we just allocated */ + /* not a good idea to call discard here directly, + * but otherwise we'd need to call it every free() */ +#ifdef EXT3_MB_HINT_GROUP_ALLOC + ext3_mb_discard_inode_preallocations(inode); +#endif + ext3_free_blocks(handle, inode, nex.ee_start, nex.ee_len, 0); goto out; } -- 1.8.3.1