From: Andreas Heinlein <aheinlein@gmx.com>
To: dm-devel@redhat.com
Subject: Possible severe bug in the device mapper?
Date: Mon, 31 Jan 2011 10:30:04 +0100 [thread overview]
Message-ID: <4D46811C.9050506@gmx.com> (raw)
Hello,
we observed the following behaviour:
1. Create a plain file on a removable drive, e.g. USB pendrive or
hotpluggable SATA drive (dd if=/dev/zero of=/media/somedrive/testfile
bs=1 count=1 seek=100000000). Don't make it bigger than ~50% of free memory.
2. Create a loopback device with this file (losetup -f
/media/somedrive/testfile)
3. Make this /dev/loopX a device mapper target. Tested with truecrypt,
dm_crypt (cryptsetup luksFormat ... and luksOpen ...) and lvm (pvcreate
/dev/loopX, vgcreate testvg /dev/loopX, lvcreate -N testlv testvg).
4. Create a filesystem on top of that mapping (mkfs.ext3 /dev/mapper/...)
5. Mount that filesystem
6. Copy some data to it
7. Remove the drive without unmounting anything
Expected behavior: Writing to the still mounted mapping should at least
give an error
Actual behavior: Reading from and writing to the mapping is still
possible, as long as the written data fits into the page cache. Even
unmounting works cleanly. When you remount the whole thing, data is
obviously lost.
This does not happen with whole block devices as targets, which is AFAIK
the case in most uses of the device mapper. We experienced this with
truecrypt volumes, where the user accidentally removed a drive
containing an encrypted TrueCrypt container. He plugged it back in, and
since everything worked, he continued to work. Only after unmounting and
re-opening the container the next day, he noticed that several hours of
work had been lost because nothing had actually been written. We are
using Ubuntu 10.04 LTS with linux 2.6.32.
Since this is reproducible with other device mapper targets, I am sure
this is not a truecrypt problem. It might be related to udev, which
AFAIK should notify higher levels when a device is removed.
IMHO, this is a rather severe problem, since loss of connection to a
device may also occur by bad cables, connections etc.
Do you have any explanation for that?
Thanks,
Andreas
next reply other threads:[~2011-01-31 9:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 9:30 Andreas Heinlein [this message]
2011-01-31 11:13 ` Possible severe bug in the device mapper? Milan Broz
2011-01-31 11:20 ` Joe Thornber
2011-02-01 9:30 ` Andreas Heinlein
2011-02-01 10:03 ` Joe Thornber
2011-02-01 10:05 ` Zdenek Kabelac
2011-02-01 13:29 ` Andreas Heinlein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D46811C.9050506@gmx.com \
--to=aheinlein@gmx.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox