Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 416353

Summary: sys-fs/e2fsprogs-1.42{,.1} - mke2fs fails on certain small device sizes
Product: Gentoo Linux Reporter: Christopher Head <bugs>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: VERIFIED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: https://sourceforge.net/tracker/?func=detail&aid=3528892&group_id=2406&atid=102406
Whiteboard:
Package list:
Runtime testing required: ---

Description Christopher Head 2012-05-17 07:29:43 UTC
Creating a filesystem under certain circumstances attempts to write beyond the end of the target device.

Reproducible: Always

Steps to Reproduce:
# lvcreate -L 256M foo vg0
# mke2fs -N 256 -t ext4 /dev/vg0/foo
Actual Results:  
mke2fs 1.42.1 (17-Feb-2012)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
256 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
32 block groups
8192 blocks per group, 8192 fragments per group
8 inodes per group
Superblock backups stored on blocks: 
	8193, 24577, 40961, 57345, 73729, 204801, 221185

Allocating group tables: done                            
Writing inode tables:  0/32
Could not write 8 blocks in inode table starting at 262144: Attempt to write block to filesystem resulted in short write

Expected Results:  
mke2fs should not attempt to write to address 262144, as that will write beyond the end of the device (and it has clearly successfully determined the size of the device, as seen by the "262144 blocks" output above)

This does *not* simply affect filesystem smaller than a certain size; the 256 MB device I showed above fails, but a 224 MB filesystem works fine! Changing the requested number of inodes (even just to 257, though not to 255) also fixes the problem.

# emerge --info sys-fs/e2fsprogs
Portage 2.1.10.49 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r3, 3.2.12-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.2.12-gentoo-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_720_@_1.60GHz-with-gentoo-2.0.3
Timestamp of tree: Thu, 17 May 2012 03:15:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r1, 3.2.3
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo kruskal-local sunrise hawk777
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.3 dlj-1.1 google-talkplugin Oracle-BCLA-JavaSE skype-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs 3 --load-average 8 --with-bdeps y"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS=""
GENTOO_MIRRORS="ftp://gentoo.arcticnetwork.ca/pub/gentoo ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles http://gentoo.osuosl.org/"
LANG="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_CA"
MAKEOPTS="--jobs 8 --load-average 8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog --delete-excluded"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/sunrise /home/chead/portage"
SYNC="rsync://rsync.ca.gentoo.org/gentoo-portage"
USE="X a52 aac acpi aio alsa amd64 archive bluetooth bzip2 cairo caps cdda cddb cdinstall cdio cli css cups custom-optimization cxx dbus dillo double-precision dri dvd faac faad fat ffmpeg fftw flac fontconfig fortran gcrypt gif gimp glade gmp gnutls gtk hou hpn iconv idn imap ios java jce joystick jpeg laptop libnotify libsamplerate mbox mikmod mmx modules mp3 mpeg multilib multiuser ncurses nls nntp nowin nptl ntfs ntp offensive ogg opengl openmp pam pdf plotutils png pppd readline scanner sdl session sou spell sse sse2 startup-notification stream svg symlink taglib theora thunar tiff truetype unicode usb vdpau videos vim-syntax vorbis xattr xft xinerama xorg xscreensaver xulrunner xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_CA" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" SANE_BACKENDS="plustek" USERLAND="GNU" VIDEO_CARDS="nvidia" XFCE_PLUGINS="logout menu" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-fs/e2fsprogs-1.42.1 was built with the following:
USE="(multilib) nls -static-libs"
Comment 1 SpanKY gentoo-dev 2012-05-22 17:44:46 UTC
simpler way to reproduce:
$ dd if=/dev/zero of=foo count=1 ibs=$(( 256 * 1024 * 1024 ))
$ mke2fs -N 256 -t ext4 foo 
...
Could not write 8 blocks in inode table starting at 4032048: Attempt to write block to filesystem resulted in short write

moved report upstream (see URL field)