Whamcloud - gitweb
LU-3014 utils: Fix an offset overflow in file_create()
authorLi Wei <wei.g.li@intel.com>
Fri, 22 Mar 2013 06:41:11 +0000 (14:41 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 29 Apr 2013 22:08:56 +0000 (18:08 -0400)
On an x86_64 machine, creating a 3 GB ZFS-based target using a file
VDev failed like this:

  mkfs.lustre FATAL: mkfs.lustre: Unable to truncate backing store:
  Invalid argument

The error, returned by the ftruncate() call in file_create(), was due
to the "int"-type calculation for the "off_t" argument.  The byte
number of 3 GB overflowed the "int" type and became a negative
"off_t".  This patch changes file_create() to take an "__u64" size
instead of an "int" one and adds "_FILE_OFFSET_BITS=64" to the
AM_CPPFLAGS of lustre/utils, so that file VDevs larger than 2 GB can
be created on both 32-bit and 64-bit x86 architectures.

Change-Id: Id7e6bfc963b0ccba8266795ba2bf9832e9c641ba
Signed-off-by: Li Wei <wei.g.li@intel.com>
Reviewed-on: http://review.whamcloud.com/5805
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>

No differences found