[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug 1884831] Re: qemu-nbd fails to discard bigger chunks
From: |
Eric Blake |
Subject: |
[Bug 1884831] Re: qemu-nbd fails to discard bigger chunks |
Date: |
Tue, 23 Jun 2020 21:35:47 -0000 |
Let's get nbd.ko out of the picture. The problem can be reproduced in
user space (here, where I built qemu-nbd to log trace messages to
stderr):
$ truncate --size=3G file
$ qemu-nbd -f raw file --trace=nbd_\*
$ nbdsh -u nbd://localhost:10810 -c 'h.trim(3*1024*1024*1024,0)'
Traceback (most recent call last):
File "/usr/lib64/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib64/python3.8/site-packages/nbd.py", line 1762, in <module>
nbdsh.shell()
File "/usr/lib64/python3.8/site-packages/nbdsh.py", line 100, in shell
exec (c, d, d)
File "<string>", line 1, in <module>
File "/usr/lib64/python3.8/site-packages/nbd.py", line 1098, in trim
return libnbdmod.trim (self._o, count, offset, flags)
nbd.Error: nbd_trim: trim: command failed: Input/output error (EIO)
and looking at the trace output from qemu-nbd, I see:
493771@1592948038.044141:nbd_negotiate_success Negotiation succeeded
493771@1592948038.044167:nbd_trip Reading request
493771@1592948038.044262:nbd_receive_request Got request: { magic = 0x25609513,
.flags = 0x0, .type = 0x4, from = 0, len = 3221225472 }
493771@1592948038.044272:nbd_co_receive_request_decode_type Decoding type:
handle = 1, type = 4 (trim)
493771@1592948038.044291:nbd_co_send_structured_error Send structured error
reply: handle = 1, error = 5 (EIO), msg = 'discard failed'
so this is definitely a case of qemu as NBD server NOT honoring requests
between 2G and 4G. I'll have a patch posted soon.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1884831
Title:
qemu-nbd fails to discard bigger chunks
Status in QEMU:
New
Bug description:
This report is moved from systemd to here:
https://github.com/systemd/systemd/issues/16242
A qemu-nbd device reports that it can discard a lot of bytes:
cat /sys/block/nbd0/queue/discard_max_bytes
2199023255040
And indeed, discard works with small images:
$ qemu-img create -f qcow2 /tmp/image.img 2M
$ sudo qemu-nbd --connect=/dev/nbd0 /tmp/image.img
$ sudo blkdiscard /dev/nbd0
but not for bigger ones (still smaller than discard_max_bytes):
$ qemu-img create -f qcow2 /tmp/image.img 5G
$ sudo qemu-nbd --connect=/dev/nbd0 /tmp/image.img
$ sudo blkdiscard /dev/nbd0
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1884831/+subscriptions