Page MenuHomeFreeBSD

Change be_mount to mount/unmount child datasets

Authored by on Jan 9 2019, 6:05 PM.



lib/libbe: open the target boot environment and get a zfs
handle, then pass that with the target mountpoint to be_mount_iter;
If the BE_MNT_DEEP flag is set call zfs_iter_filesystems and mount
the child datasets.

similar logic is employed when unmounting the datasets, save for children
are unmounted first.

sbin/bectl: change bectl_cmd_jail to pass the BE_MNT_DEEP flag when
calling be_mount as well as call be_unount when cleaning up after the
jail has exited.


Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline edited the summary of this revision. (Show Details)Jan 9 2019, 6:27 PM

Change bectl_cmd_unjail to call be_unmount instead of unmount

kevans added inline comments.Jan 9 2019, 6:54 PM
70 ↗(On Diff #52705)

Small nit while we're here: capitalize the 'c'

79 ↗(On Diff #52705)

style(9) nit: these two should be in alphabetical order

84 ↗(On Diff #52705)

Space before the opening bracket here

96 ↗(On Diff #52705)

style(9) nit: no extra spacing around this strcmp(...) != 0

120 ↗(On Diff #52705)

style(9) nit: space after if

123 ↗(On Diff #52705)

Might as well return (zfs_iter_filesystems(...)) here

138 ↗(On Diff #52705)

Space before the opening brace, and parentheses around the return valuej ust below return (err)

142 ↗(On Diff #52705)

Space before the opening brace

242 ↗(On Diff #52705)

I think we should set_error on this one

252 ↗(On Diff #52705)

Parentheses around the return value

287 ↗(On Diff #52705)

Parentheses around the return value

fixup style nits

As of r342903, be_mount_iter should be amended to do: mountpoint = be_mountpoint_augmented(info->lbh, zfs_mnt); if we're looking at a mountpoint != none and use mountpoint instead of zfs_mnt in the subsequent snprintf.

We also have an ordering issue with be_umount_iter -- if I have zpool/ROOT/default/usr and mount this to /mnt, we'll currently zfs_iter_filesystems(zpool/ROOT/default) and unmount the first one we hit, which is at /mnt. We can't unmount /mnt until we hit all the children, of course, so it blows up.

Use be_mountpoint_augmented to get the mountpoint in case of altroot scenarios.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 10 2019, 3:27 AM
This revision was automatically updated to reflect the committed changes.