Re: Enlarging w/ xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Inappropriate ioctl for device

Nick Bowler
2018-12-13T04:14:32Z

On 2018-12-12, Dave Chinner <david@fromorbit.com> wrote:
> On Tue, Dec 11, 2018 at 11:56:33PM -0500, Nick Bowler wrote:
>> OK, xfstests has revealed some trouble with the three "bulkstat" ioctls,
>> since while the xfs_bulkstat structure itself is fine, one of its members
>> is used as a pointer to various structures which are not fine. This
>> wasn't too hard to fix though.
>
> IIRC, there's bigger problems than you realise here - the bulkstat
> structure has embedded timestamps in them and on x32 struct timeval
> doesn't match either ia32 or x86-64. i.e. on ia32, struct timeval is
> 8 bytes, on x86-64 it is 16 bytes, and in x32 it is 12 bytes.

This is not the case: struct timeval is 16 bytes on x32:

sizeof (struct timeval): 16
tv_sec size: 8 offset: 0
tv_usec size: 8 offset: 8

This is the same as what I get on native 64-bit compilations; but
anyway the xfs_bstat structure has xfs_bstime members, with the
following characteristics on x32:

sizeof (struct xfs_bstime): 16
tv_sec size: 8 offset: 0
tv_nsec size: 4 offset: 8

which is also the same as native 64-bit (time_t is the same on x32 and
native: 8 bytes with 8 byte alignment).

I manually verified every member of the xfs_bstat structure with sizeof
and offsetof on -mx32 and -m64 compilations to ensure that this structure
matches precisely between the x32 and native 64-bit cases.