summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-03-14 19:26:48 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-03-15 00:14:12 -0400
commit59119646bd7e079aaed70366c405322d2dc7fa53 (patch)
treed163c085321580d2a81e7b111b0d0e68f75d070f
parentde2c477815dc6c842db60ef9187c7fddaaa3cd48 (diff)
downloade2fsprogs-59119646bd7e079aaed70366c405322d2dc7fa53.tar.gz
e2fsck: Don't blow up if the physical device is too big
If the user grows a partition bigger than 2**32 blocks, e2fsprogs 1.41.x is not going to be able to support resizing the filesystem, since it doesn't have > 2**32 block support. However, e2fsck should still work, so the system administrator doesn't get stuck. Addresses-Launchpad-Bug: #521648 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--e2fsck/e2fsck.h2
-rw-r--r--e2fsck/unix.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index ff734449..e763b89a 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -210,7 +210,7 @@ struct e2fsck_struct {
blk_t use_superblock; /* sb requested by user */
blk_t superblock; /* sb used to open fs */
int blocksize; /* blocksize */
- blk_t num_blocks; /* Total number of blocks */
+ blk64_t num_blocks; /* Total number of blocks */
int mount_flags;
blkid_cache blkid; /* blkid cache */
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 124f7e60..fd62ce5d 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1121,9 +1121,9 @@ failure:
__u32 blocksize = EXT2_BLOCK_SIZE(fs->super);
int need_restart = 0;
- pctx.errcode = ext2fs_get_device_size(ctx->filesystem_name,
- blocksize,
- &ctx->num_blocks);
+ pctx.errcode = ext2fs_get_device_size2(ctx->filesystem_name,
+ blocksize,
+ &ctx->num_blocks);
/*
* The floppy driver refuses to allow anyone else to
* open the device if has been opened with O_EXCL;
@@ -1135,9 +1135,9 @@ failure:
ext2fs_close(fs);
need_restart++;
pctx.errcode =
- ext2fs_get_device_size(ctx->filesystem_name,
- blocksize,
- &ctx->num_blocks);
+ ext2fs_get_device_size2(ctx->filesystem_name,
+ blocksize,
+ &ctx->num_blocks);
}
if (pctx.errcode == EXT2_ET_UNIMPLEMENTED)
ctx->num_blocks = 0;