All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <1422307@bugs.launchpad.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 1422307] Re: qemu-nbd corrupts files
Date: Tue, 17 Feb 2015 14:50:08 -0000	[thread overview]
Message-ID: <20150217145008.10810.11526.malone@chaenomeles.canonical.com> (raw)
In-Reply-To: 20150216100528.10277.20713.malonedeb@chaenomeles.canonical.com

Hi Pierre,

I can reproduce the bug with a 2 GB VDI image with a single
FAT32-formatted partition (on git master):

# cp src.vdi test.vdi
# ./qemu-nbd -c /dev/nbd0 test.vdi
# dd if=/dev/urandom of=/dev/nbd0 bs=1M count=64
64+0 records in
64+0 records out
67108864 bytes (67 MB) copied, 3.34091 s, 20.1 MB/s
# md5sum /dev/nbd0
bfa6726d0d8fe752c0c7dccbf770fae6  /dev/nbd0
# sync
# echo 1 > /proc/sys/vm/drop_caches
# md5sum /dev/nbd0
cb4762769e09ed6da5e327710bfb3996  /dev/nbd0
# ./qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected

Using qcow2 or not using NBD I cannot reproduce the issue. Using a qcow2
image and converting it to VDI, the issue appears again.

Using an empty VDI image, or one filled with random data, the issue does
not appear either.

I have attached a qcow2 image for others to test:

# ./qemu-img convert -O vdi src.qcow2 test.vdi; ./qemu-nbd -c /dev/nbd0 test.vdi; dd if=/dev/urandom of=/dev/nbd0 bs=1M count=64; md5sum /dev/nbd0; sync; echo 1 > /proc/sys/vm/drop_caches; md5sum /dev/nbd0; ./qemu-nbd -d /dev/nbd0                                                                                                                                                                 
64+0 records in
64+0 records out
67108864 bytes (67 MB) copied, 3.33071 s, 20.1 MB/s
9f683b4a58cecdd8da04ec2f1b7abc4a  /dev/nbd0
efb1cdd5ebe1dd326056eb2f2e500944  /dev/nbd0
/dev/nbd0 disconnected

Unfortunately, I do not yet know the cause of this issue.

Max

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1422307

Title:
  qemu-nbd corrupts files

Status in QEMU:
  New

Bug description:
  Dear all,

  On Trusty, in certain situations, try to copy files over a qemu-nbd
  mounted file system leads to write errors (and thus, file corruption).

  Here is the last example I tried:
  -> virtual disk is a VDI disk
  -> It has only one partition, in FAT

  Here is my mount process:
  # modprobe nbd max_part=63
  # qemu-nbd -c /dev/nbd0 "virtual_disk.vdi"
  # partprobe /dev/nbd0
  # mount /dev/nbd0p1 /tmp/mnt/

  Partition is properly mounted at that point:
  /dev/nbd0p1 on /tmp/mnt type vfat (rw)

  Now, when I copy a file (rather big, ~28MB):
  # cp file_to_copy /tmp/mnt/ ; sync
  # md5sum /tmp/mnt/file_to_copy
  2efc9f32e4267782b11d63d2f128a363  /tmp/mnt/file_to_copy
  # umount /tmp/mnt 
  # mount /dev/nbd0p1 /tmp/mnt/
  # md5sum /tmp/mnt/file_to_copy
  42b0a3bf73f704d03ce301716d7654de  /tmp/mnt/file_to_copy

  The first hash was obviously the right one.

  On a previous attempt I did, I spotted thanks to vbindiff that parts of the file were just filed with 0s instead of actual data.
  It will randomly work after several attempts to write.

  Version information:
  # qemu-nbd --version
  qemu-nbd version 0.0.1
  Written by Anthony Liguori.

  Cheers,

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1422307/+subscriptions

  reply	other threads:[~2015-02-17 15:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 10:05 [Qemu-devel] [Bug 1422307] [NEW] qemu-nbd corrupts files Pierre Schweitzer
2015-02-17 14:50 ` Max Reitz [this message]
2015-02-17 14:50 ` [Qemu-devel] [Bug 1422307] " Max Reitz
2015-02-17 17:18 ` Max Reitz
2015-02-17 18:22 ` Max Reitz
2015-02-17 19:21 ` Max Reitz
2015-02-17 21:25 ` Max Reitz
2015-02-18  9:11 ` Pierre Schweitzer
2015-02-18 13:58   ` Stefan Hajnoczi
2015-02-19 17:48 ` Pierre Schweitzer
2015-02-23 10:42   ` Stefan Hajnoczi
2015-04-09  8:00 ` Pierre Schweitzer
2015-07-06 11:40 ` Nicolas Rüegg
2015-07-06 13:46 ` Max Reitz
2015-07-06 14:46 ` Pierre Schweitzer
2015-08-17 10:29 ` Robie Basak
2015-08-17 10:30 ` Robie Basak
2015-08-19  7:28 ` Pierre Schweitzer
2015-08-26 16:49 ` Serge Hallyn
2015-08-26 21:32 ` Serge Hallyn
2015-08-27 22:41 ` Brian Murray
2015-08-28  6:29 ` Pierre Schweitzer
2015-08-28  6:42 ` Pierre Schweitzer
2015-09-09  1:28 ` Launchpad Bug Tracker
2015-09-09  1:28 ` [Qemu-devel] [Bug 1422307] Update Released Chris Halse Rogers

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=20150217145008.10810.11526.malone@chaenomeles.canonical.com \
    --to=1422307@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.