Skip to contentSkip to conversation

e2fsprogs: Add missed ext2fs_close

PATCH In review Dmitry Monakhov 2 participants 2 messages Jun 30, 2010 – Jul 5, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsprogs: Add missed ext2fs_close

Today i've accidentally overwrote first GB of 400Gb ext4 filesystem with zeroes :) . So journal, group descriptors, rootdir and etc was destroyed. Surprisingly i've able to recover some of my data after long fsck process. I've met only one trivial bug in initialization stage. See patch attached.

Quoted 1 line

From 57f41b37a08581f4be8e87c54d8da42d5cb62ddd Mon Sep 17 00:00:00 2001

From: root <[email protected]>
Date: Wed, 30 Jun 2010 15:06:36 +0400
Subject: [PATCH] e2fsprogs: Add missed ext2fs_close

---
 e2fsck/unix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
e2fsck/unix.c +2 -0
index bae3b38..273dbef 100644
@@ -1061,6 +1061,8 @@ restart:
 			orig_retval = retval;
 			retval = try_open_fs(ctx, flags, io_ptr, &fs);
 			if ((orig_retval == 0) && retval != 0) {
+				if (fs)
+					ext2fs_close(fs);
 				com_err(ctx->program_name, retval,
 					"when using the backup blocks");
 				printf(_("%s: going back to original "
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 5 lines · Dmitry Monakhov

Today i've accidentally overwrote first GB of 400Gb ext4 filesystem with zeroes :) . So journal, group descriptors, rootdir and etc was destroyed. Surprisingly i've able to recover some of my data after long fsck process. I've met only one trivial bug in initialization stage. See patch attached.

Thanks for catching this. I've applied the fix to my source tree.

- Ted