Bug #13897
openloader: implement mount/unmount rootfs
90%
Description
Loader does allocate segment of block cache when disk device is opened (to read filesystem from it), and this segment is freed when we close this disk device.
Unfortunately, since current loader does not "mount" file system, the disk device is closed when we close the file; so the bcache lifetime is from file open() to close(). This is less than optimal for normal loader lifetime, where we identify the boot file system (where /boot tree is), reference it via currdev environment variable, and all file accesses are done using it till the operator will change currdev variable or we boot.
To work around this issue, we save the state of current file system referenced by currdev by mount(). This state is release by unmount() when we set new value for currdev variable. This state does keep disk device(s) open and therefore the bcache segment(s) are preserved.
This also does allow us to cache filesystem metadata (such as ufs superblock).
Note, this defect does not directly affect zfs, because zfs pools are currently kept "imported" after we probe for zfs pools.
Updated by Toomas Soome about 2 years ago
- Subject changed from loader: avoid bcache flushes on currdev to loader: implement mount/unmount rootfs
- Description updated (diff)