← Back to team overview

kernel-packages team mailing list archive

[Bug 1381968] Re: Fstrim destroys data on loopback device

 

** Changed in: linux (Ubuntu)
   Importance: Undecided => Critical

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1381968

Title:
  Fstrim destroys data on loopback device

Status in “linux” package in Ubuntu:
  Confirmed

Bug description:
  I've upgraded Ubuntu Server 12.04 LTS to 14.04 LTS.

  The setup contains a loopback device (/dev/loop3) mounted into a
  software raid 1 (/dev/md2).

  After the weekly cronjob (/etc/cron.weekly/fstrim) ran, I've
  discovered that it wiped all data on the loopback device from the
  raid.

  fstrim-all skips check because the loopback device is part of device mapper raid.
  if [ "${REALDEV#/dev/dm-}" != "$REALDEV" ]; then
          echo "device $DEV is on devmapper, skipping TRIM feature check"

  Issue can be reproduced on raid setup and plain loopback mount setup!

  Here is step-by-step how to reproduce the issue:

  1.) create sparse image file
  dd of=/sparse-file bs=1k seek=1024000

  2.) losetup loopback device
  losetup /dev/loop3 /sparse-file

  3.) create raid1
  mdadm --create /dev/md2 --auto md --level=1 --raid-devices=1 /dev/loop3

  4.) create fs
  mkfs.ext4 /dev/md2

  4.1.) check sparse-file size
  ls -lash /sparse-file

  5.) mount and copy data
  mount /dev/md2 /mnt
  copy some random files on /mnt

  5.1.) check sparse-file size again
  ls -lash /sparse-file -> size indicates it contains the copied data

  6.) destroy loopback via fstrim
  fstrim -v /mnt

  7.) data is wiped
  umount /mnt
  ls -lash /sparse-file -> size indicates that all data is wiped out!
  fsck -v -f /dev/md2 -> will report infinite errors on filesystem

  I could not find any similiar bugreport.

  Best Regards
  Daniel

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1381968/+subscriptions