Bug 828303 - On PPC64, mke2fs doesn't always use all blocks on the device
On PPC64, mke2fs doesn't always use all blocks on the device
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs (Show other bugs)
5.8
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Eric Sandeen
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-04 10:22 EDT by Martin Kyral
Modified: 2012-07-12 00:22 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-12 00:22:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Kyral 2012-06-04 10:22:12 EDT
Description of problem:
When creating a filesystem with mke2fs without explicit block count specification, mke2fs is examining the block count for the device. However on PPC64 the result is often lower (always divisible by 16) than actual block count.


Version-Release number of selected component (if applicable):
e2fsprogs-1.39-33.el5.ppc

How reproducible:
Always


Steps to Reproduce:
1. dd if=/dev/zero of=/tmp/loop.bin count=1000 bs=4096
2. yes | mke2fs -T ext3 -b 4096 -m4 /tmp/loop.bin
  
Actual results:
...
512 inodes, 992 blocks
39 blocks (3.93%) reserved for the super user
...

Expected results:
...
512 inodes, 1000 blocks
40 blocks (4.00%) reserved for the super user
...


Additional info:
Happens on PowerPC only.

Workaround:
Specify the block count: yes | mke2fs -T ext3 -b 4096 -m4 /tmp/loop.bin 1000
Comment 1 Eric Sandeen 2012-07-11 18:13:49 EDT
Somehow I missed seeing this one come in.

If you have the box handy can you strace mke2fs so I can see what calls it's making?

Otherwise I'll grab a box from beaker & see what I can see.

-Eric
Comment 2 Eric Sandeen 2012-07-12 00:22:19 EDT
Ok, this is intentional, from this code in mkfs:

                        fs_param.s_blocks_count = dev_size;
                        if (sys_page_size > EXT2_BLOCK_SIZE(&fs_param))
                                fs_param.s_blocks_count &= ~((sys_page_size /
                                           EXT2_BLOCK_SIZE(&fs_param))-1);

which came from this commit:

commit a7ccdff8e128c24564011d760a996496b0a981b3
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue Jul 8 18:03:48 2003 -0400

    In mke2fs and resize2fs, round the default size of the filesystem to
    be an even multiple of the pagesize to work around a potential
    Linux kernel bug.
    
    Use the testio manager in mke2fs if CONFIG_TESTIO_DEBUG is set.

The kernel bug isn't explained, but this seems like a really low impact bug; on ppc64 you'd lose less than 64k due to the rounding.  I don't think this is something we need to mess with at this point in the RHEL5 lifecycle.  If the behavior is causing serious issues for someone, please re-open with the rationale for further work on this.

Thanks,
-Eric

Note You need to log in before you can comment on or make changes to this bug.