All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-ext4@vger.kernel.org
Subject: [PATCH] e2fsprogs: Add missed ext2fs_close
Date: Wed, 30 Jun 2010 15:24:48 +0400	[thread overview]
Message-ID: <87wrtgbw5b.fsf@dmon-lap.sw.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-e2fsprogs-Add-missed-ext2fs_close.patch --]
[-- Type: text/x-diff, Size: 769 bytes --]

>From 57f41b37a08581f4be8e87c54d8da42d5cb62ddd Mon Sep 17 00:00:00 2001
From: root <root@ws-qual.sw.ru>
Date: Wed, 30 Jun 2010 15:06:36 +0400
Subject: [PATCH] e2fsprogs: Add missed ext2fs_close


Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 e2fsck/unix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index bae3b38..273dbef 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -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 "
-- 
1.6.5.2


             reply	other threads:[~2010-06-30 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30 11:24 Dmitry Monakhov [this message]
2010-07-05 19:10 ` [PATCH] e2fsprogs: Add missed ext2fs_close tytso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrtgbw5b.fsf@dmon-lap.sw.ru \
    --to=dmonakhov@openvz.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.