Page MenuHomeFreeBSD

Make ZFS indirect (removed) vdevs support TRIM
ClosedPublic

Authored by mav on Oct 11 2018, 9:06 PM.

Details

Summary

Without this change with TRIM enabled first free for block residing on removed vdev causes either assertion "zio->io_type == ZIO_TYPE_WRITE (0x3 == 0x2)" as in bug report 229007 if built with debug, or NULL dereference as in 228750 otherwise. Both cases are caused by the fact that vdev_indirect_io_start() has no idea about ZIO_TYPE_FREE, and also about the fact that such ZIOs have no data buffer.

This patch does two things:

  • removes assertion that there are only ZIO_TYPE_READ and ZIO_TYPE_WRITE are possible;
  • adds handling for NULL data pointers in case of ZIO_TYPE_FREE.
Test Plan

Remove vdev(s) from the pool, wait for completion, delete some large files, observe BIO_DELETE's on remaining vdevs and no crash.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vdev_indirect.c
1270 ↗(On Diff #49031)

Placing the open brace in an ifdef, but not the closing brace, break auto-formatting and brace-detection.

mav marked an inline comment as done.Oct 11 2018, 9:15 PM
mav added inline comments.
vdev_indirect.c
1270 ↗(On Diff #49031)

That may be true, but I attempted to minimize code divergence.

vdev_indirect.c
1270 ↗(On Diff #49031)

I agree with mav, this ifdef is done the way that works best for future merges

This revision is now accepted and ready to land.Oct 12 2018, 2:00 AM
This revision was automatically updated to reflect the committed changes.