lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328065448-13693-1-git-send-email-xiaoqiangnk@gmail.com>
Date:	Wed,  1 Feb 2012 11:04:08 +0800
From:	Yongqiang Yang <xiaoqiangnk@...il.com>
To:	linux-ext4@...r.kernel.org, tytso@....edu, dsd@...top.org
Cc:	Yongqiang Yang <xiaoqiangnk@...il.com>
Subject: [PATCH] resize2fs: let online resizing report new blocks count right

After online resizing finishes, resize2fs loads the latest super block
so that the new blocks count is reported correctly.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@...il.com>
---
 resize/online.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/resize/online.c b/resize/online.c
index 966ea1e..cb48556 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -97,8 +97,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
 			exit(1);
 		}
 	} else {
-		close(fd);
-		return 0;
+		goto succeeded;
 	}
 
 	if ((ext2fs_blocks_count(sb) > MAX_32_NUM) ||
@@ -220,6 +219,19 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
 	}
 
 	ext2fs_free(new_fs);
+succeeded:
+	/*
+	 * load the lastest super block.
+ 	 */
+	io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
+	retval = io_channel_read_blk(fs->io, 1, -SUPERBLOCK_SIZE,
+			     fs->super);
+	if (retval == 0)
+		*new_size = ext2fs_blocks_count(fs->super);
+	else
+		printf(_("Resize succeeded, however an error happened "
+		       "when loading super block.\n\n"));
+
 	close(fd);
 
 	return 0;
-- 
1.7.5.1

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ