7673 uts: strplumb is used before it is initialized

Review Request #296 — Created Dec. 17, 2016 and submitted

tsoome
illumos-gate
7673
af8a129...
general

7673 uts: strplumb is used before it is initialized

Verified the nfs boot on single cpu system. Multi-cpu systems have another bug getting stuck while setting up additional cpu's with NFS server not responding.

tsoome
tsoome
yuripv
  1. Could you please describe the problem and the fix in more detail?

    1. The call stack is as following:

      main() -> vfs_mountroot() -> rootconf() -> getrootfs().

      The purpose of rootconf() is to detect the root file system details, and the first thing rootconf() is doing, is to call getrootfs() to establish fstype. Unfortunately the getrootfs() does also call strlumb_get_netdev_path() to establish net device path, but this call does happen too early, as strplumb module initialization will happen later in rootconf() by calling strplumb().

      So, to avoid this early call, we can rely on the fact that we have already established, we got netboot situation (as fstype is nfs), and till this moment, we have rootfs.bo_name still "/ramdisk:a" for boot archive.

      The finishing code in getrootfs() is about replacing "/ramdisk:a" in rootfs.bo_name, which is why the strlumb_get_netdev_path() is called. So, instead of calling strlumb_get_netdev_path(), we can just set rootfs.bo_name to empty string, and let rootconf() to continue to call strplumb() to set up the required modules.

      Now, the strplumb() call itself is using resolve_boot_path() to detect the root device, and as this detection is relying on rootfs.bo_name (as the same code is also used in case of sparc). So thats the reason why getrootfs() was written to populate the rootfs.bo_name.

      Fortunately, in the resolve_boot_path() we can just check the rootfs.bo_name and therefore we can break the data dependency "loop".

      So with this fix, we can avoid calling strlumb_get_netdev_path() before strplumb is set up. Moreover, we will let strplumb() code path to set up netdev_path and rootfs.bo_name for us, as the resolve_boot_path() is already gathering the needed information.

  2. 
      
danmcd
  1. Ship It!
  2. 
      
yuripv
  1. Ship It!
  2. 
      
tsoome
yuripv
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...