View Incident:
http://co-op.engr.sgi.com/BugWorks/code/bwxquery.cgi?search=Search&wlong=1&view_type=Bug&wi=801063
Status : open Priority : 3
Assigned Engineer : nathans Submitter : lord
*Modified User : lord *Modified User Domain : sgi.com
*Description :
Running mkfs to build an xfs filesystem after a partition has
been mounted as ext2 has periodically failed for me. The failure
is usually this:
[root@lord /]# mkfs -t xfs -f -l size=16000b /dev/sda4
meta-data=/dev/sda4 isize=256 agcount=8, agsize=149104 blks
data = bsize=4096 blocks=1192826, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=0
naming =version 2 bsize=4096
log =internal log bsize=4096 blocks=16000
.....
==========================
ADDITIONAL INFORMATION (ADD)
From: lord@xxxxxxx (BugWorks)
Date: Sep 08 2000 03:36:29PM
==========================
Here is what is happening here.
There are some tables in the kernel which record the size of
devices in sectors and the block size used by a filesystem.
The block character device uses these to device if an I/O is in
or out of range on the device.
So it takes the device size in raw 512 byte sectors and
converts it to bytes. It then shifts it down to be in terms
of the filesystem blocksize. When ext2 is mounted on a device
it changes the block size to be whatever its mkfs block size
was. 4K in my case. The end result is that internally the end
of the device gets rounded down to a 4 K boundary. All checks
in the code are based on a block address version of the offset
specified by the file pointer - so again rounded down to a
4 K boundary. There is then a check for this block being
>= the size of the device. An error is returned if this happens.
See block_write in fs/block_dev.c for details.
There are a few ways to fudge this:
1. repeat the same calculation in libxfs to reduce the size of
the partition we tell mkfs about - problem is there is no call
to get this block size value out of the kernel.
2. reset the block size to the hardware sector size - the only way
I can see to do this is to use the raw device interface.
3. mask off some bits in the size to round it down. By masking off
3 bits I can make this work.
2 would be best if we could figure out how to do it.
We can skip doing the write of the zeros over the last block,
but we want to write to the end of an external log - this could
hit the same issue.