[<prev] [next>] [day] [month] [year] [list]
Message-ID: <m3zm7dvk7e.fsf@bzzz.home.net>
Date: Sat, 17 Feb 2007 00:55:16 +0300
From: Alex Tomas <alex@...sterfs.com>
To: <linux-ext4@...r.kernel.org>
Subject: [PATCH] free blocks in case of error
Good day,
when ext4_ext_insert_extent() fails to insert new blocks
we should free just allocated blocks. please, consider
for review.
thanks, Alex
Signed-off-by: Alex Tomas <alex@...sterfs.com>
Index: linux-2.6.20/fs/ext4/extents.c
===================================================================
--- linux-2.6.20.orig/fs/ext4/extents.c 2007-02-11 23:16:58.000000000 +0300
+++ linux-2.6.20/fs/ext4/extents.c 2007-02-17 00:34:32.000000000 +0300
@@ -2044,8 +2044,12 @@
ext4_ext_store_pblock(&newex, newblock);
newex.ee_len = cpu_to_le16(allocated);
err = ext4_ext_insert_extent(handle, inode, path, &newex);
- if (err)
+ if (err) {
+ /* free data blocks we just allocated */
+ ext4_free_blocks(handle, inode, ext_pblock(&newex),
+ le16_to_cpu(newex.ee_len));
goto out2;
+ }
if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize)
EXT4_I(inode)->i_disksize = inode->i_size;
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists