From: Theodore Ts'o Date: Sun, 14 Mar 2010 23:26:48 +0000 (-0400) Subject: e2fsck: Don't blow up if the physical device is too big X-Git-Tag: v1.41.11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59119646bd7e079aaed70366c405322d2dc7fa53;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index ff734449a..e763b89a4 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 124f7e606..fd62ce5dd 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;