HomeFreeBSD

Fix 'zpool remap' freeing race

Description

Fix 'zpool remap' freeing race

The dmu_objset_remap_indirects_impl() logic depends on dnode_hold()
returning ENOENT for dnodes which will be freed and should be skipped.

This behavior can only be relied upon when taking a new hold and
while the caller has an open transaction. This ensures that the
open txg cannot advance and that a concurrent free will end up
in the same txg (which is critical). Relying on an existing hold
will not prevent dnode_free() from succeeding.

The solution is to take an additional dnode_hold() after assigning
the transaction. This ensures the remap will never dirty the dnode
if it was freed while we were waiting in dmu_tx_assign(, TXG_WAIT).

Randomly set zfs_object_remap_one_indirect_delay_ms in ztest. This
increases the likelihood of an operation racing with the remap.
Converted from ticks to milliseconds.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Tom Caputi <tcaputi@datto.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8215

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Jan 2 2019, 7:46 PM
GitHub <noreply@github.com>Committed on Jan 2 2019, 7:46 PM
Parents
rG06f3fc2a4b09: Minor tweaks to zfs.8 man page for POSIX ACLs
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG65ca2c1eb9af: Fix 'zpool remap' freeing race (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Jan 2 2019, 7:46 PM