HomeFreeBSD

Fix ztest vdev file paths.

Description

Fix ztest vdev file paths.

Currently, in several instances (but not all), ztest generates vdev
file paths using a statement similar to this:

snprintf(path, sizeof (path), ztest_dev_template, ...);

This worked fine until 40b84e7aec6392187722e61e5a4a853b530bf60f, which
changed path to be a pointer to the heap instead of an array allocated
on the stack. Before this change, sizeof(path) would return the size of
the array; now, it returns the size of the pointer instead.

As a result, the aforementioned sprintf statement uses the wrong size
and truncates the vdev file path to the first 4 or 8 bytes (depending
on the architecture). Typically, with default settings, the file path
will become "/tmp/zt" instead of "/test/ztest.XXX".

This issue only exists in ztest_vdev_attach_detach() and
ztest_fault_inject(), which explains why ztest doesn't fail right away.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #989

Details

Provenance
Etienne Dechamps <etienne.dechamps@ovh.net>Authored on Oct 1 2012, 2:34 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Oct 3 2012, 8:32 PM
Parents
rG274091c07482: Fix VOP_CLOSE() in userspace.
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG6aec1cd5a674: Fix ztest vdev file paths. (authored by Etienne Dechamps <etienne.dechamps@ovh.net>).Oct 3 2012, 8:32 PM