linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] free blocks in case of error
@ 2007-02-16 21:55 Alex Tomas
  0 siblings, 0 replies; only message in thread
From: Alex Tomas @ 2007-02-16 21:55 UTC (permalink / raw)
  To: linux-ext4


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@clusterfs.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;

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

only message in thread, other threads:[~2007-02-16 22:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-16 21:55 [PATCH] free blocks in case of error Alex Tomas

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).