Package: e2fsprogs
Version: 1.42.5-1.1
Severity: minor
Tags: patch upstream

e2freefrag report incoherent information on a large filesystem with large
chunks of contiguous free space, due to integer overflow in computing max free
extent.  I did not check if it's really present upstream, but I believe it
likely.

In the following output, max free < 1G disagree with 1 extent >= 16 GB.  A
minimal --- meaning that no types are changed --- patch is attached.

best regards,
        g

:   Device: /dev/sda6
:   Blocksize: 4096 bytes
:   Total blocks: 29302784
:   Free blocks: 11744387 (40.1%)
:
:   Min. free extent: 4 KB 
:   Max. free extent: 653272 KB
:   Avg. free extent: 15828 KB
:   Num. free extent: 3012
:
:   HISTOGRAM OF FREE EXTENT SIZES:
:   Extent Size Range :  Free extents   Free Blocks  Percent
:       4K...    8K-  :           333           333    0.00%
:       8K...   16K-  :           206           484    0.00%
:      16K...   32K-  :           258          1370    0.01%
:      32K...   64K-  :           292          3283    0.03%
:      64K...  128K-  :           334          7571    0.06%
:     128K...  256K-  :           212          9617    0.08%
:     256K...  512K-  :           214         19276    0.16%
:     512K... 1024K-  :           323         58533    0.50%
:       1M...    2M-  :           449        168768    1.44%
:       2M...    4M-  :           287        203716    1.73%
:       4M...    8M-  :            98        117878    1.00%
:      16M...   32M-  :             1          7678    0.07%
:      32M...   64M-  :             1         12337    0.11%
:      64M...  128M-  :             1         18610    0.16%
:       8G...   16G-  :             2       5884523   50.10%
:      16G...   32G-  :             1       5406198   46.03%

-- System Information:
Debian Release: 7.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages e2fsprogs depends on:
ii  e2fslibs    1.42.5-1.1
ii  libblkid1   2.20.1-5.3
ii  libc6       2.13-38
ii  libcomerr2  1.42.5-1.1
ii  libss2      1.42.5-1.1
ii  libuuid1    2.20.1-5.3
ii  util-linux  2.20.1-5.3

e2fsprogs recommends no packages.

Versions of packages e2fsprogs suggests:
pn  e2fsck-static  <none>
pn  gpart          <none>
ii  parted         2.3-12

-- no debconf information
--- misc/e2freefrag.c.orig	2013-07-28 20:09:52.000000000 +0200
+++ misc/e2freefrag.c	2013-07-28 20:10:05.000000000 +0200
@@ -172,10 +172,16 @@
 
 	/* Display chunk information in KB */
 	if (info->real_free_chunks) {
-		info->min = (info->min * fs->blocksize) >> 10;
-		info->max = (info->max * fs->blocksize) >> 10;
+	    	unsigned long scaled_blocksize = fs->blocksize;
+		int shift = 10;
+		if (fs->blocksize >= (1 << 10)) {
+		    	shift = 0;
+			scaled_blocksize = fs->blocksize >> 10;
+		}
+		info->min = (info->min * scaled_blocksize) >> shift;
+		info->max = (info->max * scaled_blocksize) >> shift;
 		info->avg = (info->avg / info->real_free_chunks *
-			     fs->blocksize) >> 10;
+			     scaled_blocksize) >> shift;
 	} else {
 		info->min = 0;
 	}

Reply via email to