Whamcloud - gitweb
e2fsck: Add missing ext2fs_close() call when going back to original superblock
authorTheodore Ts'o <tytso@mit.edu>
Mon, 5 Jul 2010 19:06:37 +0000 (15:06 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 5 Jul 2010 19:06:37 +0000 (15:06 -0400)
In the case where the original superblock and the backup superblock
are both invalid in some way, e2fsck will try to go back to the
orignal superblock.  To do that, it must close the attempted open
using the backup superblock first (since otherwise the exclusive open
will prevent the subsequent open from succeding).

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/unix.c

index 34fa9b1..4a299ef 100644 (file)
@@ -1054,6 +1054,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 "