Hide Forgot
This bug has been copied from bug #1196688 and has been proposed to be backported to 7.1 z-stream (EUS).
Posted patch. Sorry for the delay, there was an issue with the last patch I posted and I missed that the patch had been dropped.
Fix included in qemu-kvm-rhev-2.1.2-23.el7_1_1.2
Test on qemu-kvm-rhev-2.1.2-23.el7.x86_64. Steps as bz 1196688 comment#0. Steps: 1. qemu-img create input.img 2G 2. qemu-img create output.img 2G 3. sudo losetup -f output.img 4. qemu-img convert -t none -O raw input.img /dev/loop0 Actual results: After step 4, can not find any error. Stefan and Jan, Could you help to check above reproduce method is right or not? If incorrect, could you give some suggestions? Another question, does QE need to do more testing for verify this bz. Thx. Regards, Jun Li
(In reply to Jun Li from comment #20) > Test on qemu-kvm-rhev-2.1.2-23.el7.x86_64. Steps as bz 1196688 comment#0. > > Steps: > 1. qemu-img create input.img 2G > 2. qemu-img create output.img 2G > 3. sudo losetup -f output.img > 4. qemu-img convert -t none -O raw input.img /dev/loop0 > > > Actual results: > After step 4, can not find any error. > > Stefan and Jan, > > Could you help to check above reproduce method is right or not? If > incorrect, could you give some suggestions? > > Another question, does QE need to do more testing for verify this bz. Thx. That verifies the fix, additional tests are not necessary. Thank you! Stefan
(In reply to Stefan Hajnoczi from comment #23) > (In reply to Jun Li from comment #20) > > Test on qemu-kvm-rhev-2.1.2-23.el7.x86_64. Steps as bz 1196688 comment#0. > > > > Steps: > > 1. qemu-img create input.img 2G > > 2. qemu-img create output.img 2G > > 3. sudo losetup -f output.img > > 4. qemu-img convert -t none -O raw input.img /dev/loop0 > > > > > > Actual results: > > After step 4, can not find any error. > > > > Stefan and Jan, > > > > Could you help to check above reproduce method is right or not? If > > incorrect, could you give some suggestions? > > > > Another question, does QE need to do more testing for verify this bz. Thx. > > That verifies the fix, additional tests are not necessary. Thank you! > > Stefan Hi Stefan, Seems above method can not reproduce this issue. QE just do a simple debug, seems can not call bdrv_make_zero() when execute "qemu-img convert -t none -O raw input.img /dev/loop0". static int img_convert(int argc, char **argv) { ... +-------> Here will return 0. | if (!has_zero_init && bdrv_can_write_zeroes_with_unmap(out_bs)) { ret = bdrv_make_zero(out_bs, BDRV_REQ_MAY_UNMAP); if (ret < 0) { goto out; } ... } As bdrv_can_write_zeroes_with_unmap(out_bs) will return 0, so can not call bdrv_make_zero(out_bs, BDRV_REQ_MAY_UNMAP). bdrv_can_write_zeroes_with_unmap bdrv_get_info int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (!drv->bdrv_get_info) -----> Here !drv->bdrv_get_info will be 1. return -ENOTSUP; | memset(bdi, 0, sizeof(*bdi)); | return drv->bdrv_get_info(bs, bdi); | } | | \|/ I don't know why here is 1. Could you give some explanations and suggestions ? Thx. Regards, Jun Li
(In reply to Jun Li from comment #24) > (In reply to Stefan Hajnoczi from comment #23) > > (In reply to Jun Li from comment #20) > > > Test on qemu-kvm-rhev-2.1.2-23.el7.x86_64. Steps as bz 1196688 comment#0. > > > > > > Steps: > > > 1. qemu-img create input.img 2G > > > 2. qemu-img create output.img 2G > > > 3. sudo losetup -f output.img > > > 4. qemu-img convert -t none -O raw input.img /dev/loop0 > > > > > > > > > Actual results: > > > After step 4, can not find any error. > > > > > > Stefan and Jan, > > > > > > Could you help to check above reproduce method is right or not? If > > > incorrect, could you give some suggestions? > > > > > > Another question, does QE need to do more testing for verify this bz. Thx. > > > > That verifies the fix, additional tests are not necessary. Thank you! > > > > Stefan > > Hi Stefan, > > Seems above method can not reproduce this issue. > > QE just do a simple debug, seems can not call bdrv_make_zero() when execute > "qemu-img convert -t none -O raw input.img /dev/loop0". I cannot reproduce what you are showing: $ git log --oneline 509328f block: Fix max nb_sectors in bdrv_make_zero 230c69c Update to qemu-kvm-rhev-2.1.2-23.el7 $ gdb ./qemu-img --args ./qemu-img convert -t none -O raw input.img /dev/loop0 (gdb) b bdrv_can_write_zeroes_with_unmap (gdb) r (gdb) finish Run till exit from #0 bdrv_can_write_zeroes_with_unmap ( bs=0x555555c65ac0) at block.c:3950 0x0000555555569194 in img_convert (argc=<optimized out>, argv=<optimized out>) at qemu-img.c:1608 1608 if (!has_zero_init && bdrv_can_write_zeroes_with_unmap(out_bs)) { Value returned is $1 = true The function is returning true, so the bdrv_make_zero() code path gets taken. Can you retry with the exact GDB commands that I have provided?
(In reply to Stefan Hajnoczi from comment #25) > (In reply to Jun Li from comment #24) > > (In reply to Stefan Hajnoczi from comment #23) > > > (In reply to Jun Li from comment #20) > > > > Test on qemu-kvm-rhev-2.1.2-23.el7.x86_64. Steps as bz 1196688 comment#0. > > > > > > > > Steps: > > > > 1. qemu-img create input.img 2G > > > > 2. qemu-img create output.img 2G > > > > 3. sudo losetup -f output.img > > > > 4. qemu-img convert -t none -O raw input.img /dev/loop0 > > > > > > > > > > > > Actual results: > > > > After step 4, can not find any error. > > > > > > > > Stefan and Jan, > > > > > > > > Could you help to check above reproduce method is right or not? If > > > > incorrect, could you give some suggestions? > > > > > > > > Another question, does QE need to do more testing for verify this bz. Thx. > > > > > > That verifies the fix, additional tests are not necessary. Thank you! > > > > > > Stefan > > > > Hi Stefan, > > > > Seems above method can not reproduce this issue. > > > > QE just do a simple debug, seems can not call bdrv_make_zero() when execute > > "qemu-img convert -t none -O raw input.img /dev/loop0". > > I cannot reproduce what you are showing: > > $ git log --oneline > 509328f block: Fix max nb_sectors in bdrv_make_zero > 230c69c Update to qemu-kvm-rhev-2.1.2-23.el7 > $ gdb ./qemu-img --args ./qemu-img convert -t none -O raw input.img > /dev/loop0 > (gdb) b bdrv_can_write_zeroes_with_unmap > (gdb) r > (gdb) finish > Run till exit from #0 bdrv_can_write_zeroes_with_unmap ( > bs=0x555555c65ac0) at block.c:3950 > 0x0000555555569194 in img_convert (argc=<optimized out>, > argv=<optimized out>) at qemu-img.c:1608 > 1608 if (!has_zero_init && bdrv_can_write_zeroes_with_unmap(out_bs)) > { > Value returned is $1 = true > > The function is returning true, so the bdrv_make_zero() code path gets taken. > > Can you retry with the exact GDB commands that I have provided? Hi Stefan, So Sorry. Wrong qemu-img shell execute environment. # which qemu-img /usr/local/bin/qemu-img # rpm -ql qemu-img-rhev-2.1.2-23.el7.x86_64 /usr/bin/qemu-img /usr/bin/qemu-io /usr/bin/qemu-nbd /usr/share/man/man1/qemu-img.1.gz /usr/share/man/man8/qemu-nbd.8.gz Then using the correct qemu-img shell path test as followings: Reproduce: Version of components: qemu-img-rhev-2.1.2-23.el7.x86_64 # losetup -D # losetup -l # /usr/bin/qemu-img create input.img 2G Formatting 'input.img', fmt=raw size=2147483648 # /usr/bin/qemu-img create output.img 2G Formatting 'output.img', fmt=raw size=2147483648 # losetup -f output.img # losetup -l NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 0 0 /tmp/output.img # /usr/bin/qemu-img convert -t none -O raw input.img /dev/loop0 qemu-img: error writing zeroes at sector 0: Invalid argument As above show, this bz has been reproduced. Verify: Version of components: qemu-img-rhev-2.1.2-23.el7_1.2.x86_64 Steps: 1, # losetup -D 2, # losetup -l 3, # /usr/bin/qemu-img create input.img 2G Formatting 'input.img', fmt=raw size=2147483648 4, # /usr/bin/qemu-img create output.img 2G Formatting 'output.img', fmt=raw size=2147483648 5, # losetup -f output.img 6, # losetup -l NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 0 0 /tmp/output.img 7, # /usr/bin/qemu-img convert -t none -O raw input.img /dev/loop0 After step 7, no any error occur. Based on above show, this bz has been verified. Thanks Stefan again. Regards, Jun Li
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0952.html