| 1 | #!/usr/bin/env bash |
| 2 | # group: rw auto quick |
| 3 | # |
| 4 | # Check that detect-zeroes=unmap works on writes with registered I/O buffers. |
| 5 | # This is a regression test for |
| 6 | # https://gitlab.com/qemu-project/qemu/-/issues/1404 where I/O requests failed |
| 7 | # unexpectedly. |
| 8 | # |
| 9 | # Copyright Red Hat |
| 10 | # |
| 11 | # This program is free software; you can redistribute it and/or modify |
| 12 | # it under the terms of the GNU General Public License as published by |
| 13 | # the Free Software Foundation; either version 2 of the License, or |
| 14 | # (at your option) any later version. |
| 15 | # |
| 16 | # This program is distributed in the hope that it will be useful, |
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | # GNU General Public License for more details. |
| 20 | # |
| 21 | # You should have received a copy of the GNU General Public License |
| 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | # |
| 24 | |
| 25 | # creator |
| 26 | owner=stefanha@redhat.com |
| 27 | |
| 28 | seq=`basename $0` |
| 29 | echo "QA output created by $seq" |
| 30 | |
| 31 | status=1 # failure is the default! |
| 32 | |
| 33 | _cleanup() |
| 34 | { |
| 35 | _cleanup_test_img |
| 36 | } |
| 37 | trap "_cleanup; exit \$status" 0 1 2 3 15 |
| 38 | |
| 39 | IMGOPTSSYNTAX=true |
| 40 | |
| 41 | # get standard environment, filters and checks |
| 42 | cd .. |
| 43 | . ./common.rc |
| 44 | . ./common.filter |
| 45 | |
| 46 | _supported_fmt qcow2 |
| 47 | _supported_proto generic |
| 48 | |
| 49 | size=128M |
| 50 | _make_test_img $size |
| 51 | IMGSPEC="$TEST_IMG,discard=unmap,detect-zeroes=unmap" |
| 52 | |
| 53 | echo |
| 54 | echo "== writing zero buffer to image ==" |
| 55 | QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" $QEMU_IO -c "write -r -P 0 0 4k" --image-opts "$IMGSPEC" | _filter_qemu_io |
| 56 | |
| 57 | # success, all done |
| 58 | echo "*** done" |
| 59 | rm -f $seq.full |
| 60 | status=0 |