[Ocfs2-tools-devel] [PATCH 1/1] Fix a wrong usage of "startblk"
during offline resize and backup super.
Tao Ma
tao.ma at oracle.com
Mon Nov 5 22:27:33 PST 2007
During offline resize, opts.num_blocks indicates the block count for
the ocfs2 volume, not the increased block count. But update_backup_super
use the wrong meaning by mistake. So when we increase the block into a
a number which isn't aligned with cluster size, startblk will overflow
since fs->fs_blocks will be lower than num_blocks and no backup super
blocks will be allocated since ocfs2_set_backup_super will never be
called.
So record the old_blocks when we do offline resize and that is the
really start offset for the new blocks.
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
tunefs.ocfs2/tunefs.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index 85070f7..6b2db21 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -1195,12 +1195,12 @@ static errcode_t refresh_backup_super(ocfs2_filesys *fs)
return ret;
}
-static errcode_t update_backup_super(ocfs2_filesys *fs, uint64_t newblocks)
+static errcode_t update_backup_super(ocfs2_filesys *fs, uint64_t startblk,
+ uint64_t newblocks)
{
errcode_t ret;
int num, i;
uint64_t *new_backup_super, blocks[OCFS2_MAX_BACKUP_SUPERBLOCKS];
- uint64_t startblk = fs->fs_blocks - newblocks;
num = ocfs2_get_backup_super_offset(fs, blocks, ARRAY_SIZE(blocks));
if (!num)
@@ -1259,6 +1259,7 @@ int main(int argc, char **argv)
uint16_t max_slots;
uint64_t def_jrnl_size = 0;
uint64_t num_clusters;
+ uint64_t old_blocks = 0;
int dirty = 0;
char old_uuid[OCFS2_VOL_UUID_LEN * 2 + 1];
char new_uuid[OCFS2_VOL_UUID_LEN * 2 + 1];
@@ -1540,6 +1541,7 @@ int main(int argc, char **argv)
/* update volume size */
if (opts.num_blocks) {
+ old_blocks = fs->fs_blocks;
ret = update_volume_size(fs, &upd_blocks);
if (ret) {
com_err(opts.progname, ret,
@@ -1559,7 +1561,7 @@ int main(int argc, char **argv)
OCFS2_HAS_COMPAT_FEATURE(OCFS2_RAW_SB(fs->fs_super),
OCFS2_FEATURE_COMPAT_BACKUP_SB))) {
block_signals(SIG_BLOCK);
- ret = update_backup_super(fs, opts.num_blocks);
+ ret = update_backup_super(fs, old_blocks, opts.num_blocks);
block_signals(SIG_UNBLOCK);
if (ret) {
com_err(opts.progname, ret,
--
1.5.3.2.g4f337
More information about the Ocfs2-tools-devel
mailing list