Page MenuHomeFreeBSD

libbe(3): promote dependent clones when destroying an environment
ClosedPublic

Authored by jwmaag_gmail.com on Dec 29 2019, 5:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 6:10 AM
Unknown Object (File)
Nov 6 2024, 2:03 PM
Unknown Object (File)
Nov 5 2024, 3:56 PM
Unknown Object (File)
Oct 26 2024, 8:58 PM
Unknown Object (File)
Oct 12 2024, 6:06 PM
Unknown Object (File)
Oct 12 2024, 6:05 PM
Unknown Object (File)
Oct 1 2024, 3:40 PM
Unknown Object (File)
Oct 1 2024, 11:01 AM
Subscribers

Details

Summary

When removing a boot environment iterate over the dependents and
process the snapshots by grabbing any clones. Promote the clones we
found and then remove the target environment.

Test Plan
  • create a boot environment be0
  • create two boot environments from be0 (be1, be2)
  • destroy be0
  • destroy be1
  • create be1 from be0
  • create be2 from be1
  • create be3 from be2
  • destroy be2, be3, be1

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jwmaag_gmail.com retitled this revision from Fix boot environment deletion with dependent clones to libbe(3): promote dependent clones when destroying an environment.Dec 29 2019, 5:37 AM

Overall approach LGTM.

lib/libbe/be.c
205 ↗(On Diff #66129)

"promote"

223 ↗(On Diff #66129)

This initialization should probably be moved down to just before we iterate over the promotelist; once found is set, we're never resetting it back to false.

243 ↗(On Diff #66129)

space after if

247 ↗(On Diff #66129)

space after if

272 ↗(On Diff #66129)

space after while

407 ↗(On Diff #66129)

space after if, before opening brace.

sbin/bectl/tests/bectl_test.sh
151 ↗(On Diff #66129)

Unwanted trailing space.

fix nits, rearrange promote list unique logic

lib/libbe/be.c
250 ↗(On Diff #66152)

newentry is leaked here

252 ↗(On Diff #66152)

We should check return value of strdup here, too, while we're at it.

free newentry when following the dup or error path

on allocation failures, set err = enomem and break out of the loop so we clean up any nvlists/zfs handles instead of just returning

This revision was not accepted when it landed; it landed in state Needs Review.Jan 2 2020, 6:46 PM
This revision was automatically updated to reflect the committed changes.