[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#811357: linux-image-4.3.0-1-amd64: btrfs FITRIM endless loop



Package: src:linux
Version: 4.3.3-5
Severity: normal

I'm using BTRFS as root filesystem (with luks and DRBD 8.4.7 below), on 
a partition on a SSD.

Running the command 
    $ fstrim -v -o 100000000 -l 100000000 /

shows up in strace as 
    open("/", O_RDONLY)                     = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=278, ...}) = 0
    ioctl(4, FITRIM, {start=0x5f5e100, len=0x5f5e100, minlen=0}^C^C^C^CProcess 20160 detached
     <detached ...>

but a "btrace" output shows this:
    147,9    2     1125     0.505991030 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1126     0.505991386 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1127     0.506298337 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1128     0.506298680 20160  Q   D 411104 + 1 [fstrim]
    147,9    2     1129     0.506554199 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1130     0.506554518 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1131     0.506806643 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1132     0.506806977 20160  Q   D 411104 + 1 [fstrim]
    147,9    2     1133     0.507059795 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1134     0.507060125 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1135     0.507311777 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1136     0.507312087 20160  Q   D 411104 + 1 [fstrim]
    147,9    2     1137     0.507563697 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1138     0.507564052 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1139     0.507815066 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1140     0.507815413 20160  Q   D 411104 + 1 [fstrim]
    147,9    2     1141     0.508063192 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1142     0.508063518 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1143     0.508313576 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1144     0.508313853 20160  Q   D 411104 + 1 [fstrim]
    147,9    2     1145     0.508549305 20160  A   D 2508256 + 1 <- (252,0) 2504160
    147,9    2     1146     0.508549637 20160  Q   D 2508256 + 1 [fstrim]
    147,9    2     1147     0.508813063 20160  A   D 411104 + 1 <- (252,0) 407008
    147,9    2     1148     0.508813372 20160  Q   D 411104 + 1 [fstrim]

Ie. "fstrim" makes the kernel's BTRFS FITRIM submit always the same two 
block numbers, seemingly in an endless loop.


Perhaps related, running the command
    $ fstrim -v -o 0 -l 1000000000 /

(ie. trim within the first 1 GB) returned
    /: 2 GiB (2159243264 bytes) trimmed

and
    $ fstrim -v -o 0 -l 100000000 /

(trim 100MB) said
    /: 991,6 MiB (1039757312 bytes) trimmed

which is unexpected, too - the manual page states the units are bytes.


Not sure how easy that is to reproduce - the root filesystem on that 
machine is 21 months old, and has seen quite a lot of dist-upgrades 
inbetween, so it might be heavily fragmented.


-- Package-specific info:
** Version:
Linux version 4.3.0-1-amd64 (debian-kernel@lists.debian.org) (gcc version 5.3.1 20160101 (Debian 5.3.1-5) ) #1 SMP Debian 4.3.3-5 (2016-01-04)

** Command line:
BOOT_IMAGE=/vmlinuz-4.3.0-1-amd64 root=UUID=1bfc62e3-f883-42f0-a2aa-3c67ee6f563f ro quiet no_console_suspend=1 noresume cryptopts=source=/dev/drbd9,target=sda2_crypt,discard,rootdev cgroup_enable=memory swapaccount=1

** Tainted: PWO (4609)
 * Proprietary module has been loaded.
 * Taint on warning.
 * Out-of-tree module has been loaded.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages linux-image-4.3.0-1-amd64 depends on:
ii  debconf [debconf-2.0]                   1.5.58
ii  initramfs-tools [linux-initramfs-tool]  0.120
ii  kmod                                    21-1
ii  linux-base                              4.0

Versions of packages linux-image-4.3.0-1-amd64 recommends:
ii  firmware-linux-free  3.4
ii  irqbalance           1.1.0-2

Versions of packages linux-image-4.3.0-1-amd64 suggests:
pn  debian-kernel-handbook  <none>
ii  extlinux                3:6.03+dfsg-11
ii  grub-efi                2.02~beta2-33
pn  linux-doc-4.3           <none>

Versions of packages linux-image-4.3.0-1-amd64 is related to:
pn  firmware-atheros                         <none>
pn  firmware-bnx2                            <none>
ii  firmware-bnx2x                           20160110-1
ii  firmware-brcm80211                       20160110-1
pn  firmware-intelwimax                      <none>
pn  firmware-ipw2x00                         <none>
pn  firmware-ivtv                            <none>
pn  firmware-iwlwifi                         <none>
pn  firmware-libertas                        <none>
ii  firmware-linux                           20160110-1
ii  firmware-linux-nonfree                   20160110-1
ii  firmware-misc-nonfree [firmware-ralink]  20160110-1
pn  firmware-myricom                         <none>
pn  firmware-netxen                          <none>
pn  firmware-qlogic                          <none>
ii  firmware-realtek                         20160110-1
pn  xen-hypervisor                           <none>

-- debconf information:
  linux-image-4.3.0-1-amd64/postinst/mips-initrd-4.3.0-1-amd64:
  linux-image-4.3.0-1-amd64/postinst/depmod-error-initrd-4.3.0-1-amd64: false
  linux-image-4.3.0-1-amd64/prerm/removing-running-kernel-4.3.0-1-amd64: true


Reply to: