Skip to content

Commit

Permalink
Fixed unneeded memcpy on it self in zio_ready(zio_t *zio).
Browse files Browse the repository at this point in the history
In zio_ready(), under some condition a blockpointer is copied into
itself, i.e. bptr_t bp1, *bp2;  bp2 = &bp;  bp1 = *bp2;
This produces a memcpy overlap error in valgrind.

The real question of course is, if trying to copy the blockpointer
into itself is a legitimate operation here.  Not sure.

Call tree for the offending copy:
==00:00:00:02.705 27867== Source and destination overlap in memcpy(0x1004b94f8, 0x1004b94f8, 128)
==00:00:00:02.705 27867==    at 0x10016AD73: memcpy (mc_replace_strmem.c:523)
==00:00:00:02.705 27867==    by 0x1000B954C: zio_ready (zio.c:919)
==00:00:00:02.705 27867==    by 0x1000BE103: zio_next_stage (zio.c:2024)
==00:00:00:02.705 27867==    by 0x1000B9192: zio_wait_for_children (zio.c:846)
==00:00:00:02.705 27867==    by 0x1000B93BA: zio_wait_children_ready (zio.c:874)
==00:00:00:02.705 27867==    by 0x1000BE38A: zio_next_stage_async (zio.c:2073)
==00:00:00:02.705 27867==    by 0x1000B9111: zio_nowait (zio.c:833)
==00:00:00:02.705 27867==    by 0x10009B7D8: vdev_label_read (vdev_label.c:168)
==00:00:00:02.705 27867==    by 0x10009C69D: vdev_label_read_config (vdev_label.c:336)
==00:00:00:02.705 27867==    by 0x100096FD3: vdev_validate (vdev.c:1009)
==00:00:00:02.705 27867==    by 0x100096F80: vdev_validate (vdev.c:999)
==00:00:00:02.705 27867==    by 0x100096F80: vdev_validate (vdev.c:999)
==00:00:00:02.705 27867==
  • Loading branch information
BjoKaSH committed Sep 5, 2012
1 parent e85d2cc commit 339b734
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usr/src/uts/common/fs/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,8 @@ zio_ready(zio_t *zio)
&pio->io_children_notready);

if (zio->io_bp)
zio->io_bp_copy = *zio->io_bp;
if (&zio->io_bp_copy != zio->io_bp) /* do not copy block over itself. */
zio->io_bp_copy = *zio->io_bp;

zio_next_stage(zio);
}
Expand Down

0 comments on commit 339b734

Please sign in to comment.