Project

General

Profile

Bug #12141

Updated by Andy Fiddaman almost 2 years ago

As part of creating a new boot environment, the @/etc/vfstab@ entries for any legacy-mounted filesystems under the root dataset are updated to reflect the new BE. This works fine in the GZ (including for any linked child zones) but not directly within an NGZ. 

 To replicate create a zone with legacy mounts under the root dataset, for example (this is an OmniOS sparse zone): 

 <pre> 
 ngzone# grep ROOT /etc/vfstab 
 data/zone/ngzone/ROOT/zbe/svc - /lib/svc zfs - no - 
 data/zone/ngzone/ROOT/zbe/fm - /usr/lib/fm zfs - no - 

 ngzone# df -h | grep data/zone/ngzone 
 data/zone/ngzone/ROOT/zbe    3.51T     311M        1.42T       1%      / 
 data/zone/ngzone/ROOT/zbe/svc    3.51T    1.56M        1.42T       1%      /lib/svc 
 data/zone/ngzone/ROOT/zbe/fm    3.51T    1.59M        1.42T       1%      /usr/lib/fm 
 </pre> 

 Creating a new BE within the zone will fail: 

 <pre> 
 ngzone# beadm create -v test 
 be_mount_callback: no entry for data/zone/ngzone/ROOT/test/fm in vfstab, skipping ... 
 be_mount_callback: no entry for data/zone/ngzone/ROOT/test/svc in vfstab, skipping ... 
 _update_vfstab: Failed to update device field for vfstab entry data/zone/ngzone/ROOT/zbe/svc 
 be_copy: failed to update new BE's vfstab (test) 
 be_copy: destroying partially created boot environment 
 Unable to create test. 
 Invalid argument. 
 zsh: exit 176     beadm create -v test 
 </pre> 

 This is a bug in @libbe@'s @be_copy()@ function which calls @be_update_vfstab()@ with the wrong parameters. 

 <pre> 
 ngzone# dtrace -n 'pid$target::be_update_vfstab:entry{trace(copyinstr(arg1))}' -c 'beadm create test' 
 dtrace: description 'pid$target::be_update_vfstab:entry' matched 1 probe 
 CPU       ID                      FUNCTION:NAME 
  25    91387             be_update_vfstab:entry     data 
 Unable to create test. 
 Invalid argument. 
 </pre> 

 @be_copy_zones()@ gets this right when updating child linked zones, which is why the operation works when run from the GZ. 

 <pre> 
 gz# cat /data/zone/ngzone/root/etc/vfstab 
 #device           device            mount             FS        fsck      mount     mount 
 #to mount         to fsck           point             type      pass      at boot options 
 # 
 /devices          -                 /devices          devfs     -         no        - 
 /proc             -                 /proc             proc      -         no        - 
 ctfs              -                 /system/contract ctfs     -         no        - 
 objfs             -                 /system/object    objfs     -         no        - 
 sharefs           -                 /etc/dfs/sharetab         sharefs -         no       - 
 fd                -                 /dev/fd           fd        -         no        - 
 swap              -                 /tmp              tmpfs     -         yes       - 

 data/zone/ngzone/ROOT/zbe/svc - /lib/svc zfs - no - 
 data/zone/ngzone/ROOT/zbe/fm - /usr/lib/fm zfs - no - 

 gz# beadm dtrace -n 'pid$target::be_update_vfstab:entry{trace(copyinstr(arg1))}' -c 'beadm create test test' 
 dtrace: description 'pid$target::be_update_vfstab:entry' matched 1 probe 
 CPU       ID                      FUNCTION:NAME 
   6    91141             be_update_vfstab:entry     rpool 
 Created successfully 
 dtrace: pid 10885 has exited 

 gz# beadm mount test /a 
 Mounted successfully on: '/a' 
 gz# cat /a/data/zone/ngzone/root/etc/vfstab 
 #device           device            mount             FS        fsck      mount     mount 
 #to mount         to fsck           point             type      pass      at boot options 
 # 
 /devices          -         /devices          devfs     -         no        - 
 /proc     -         /proc     proc      -         no        - 
 ctfs      -         /system/contract          ctfs      -         no        - 
 objfs     -         /system/object    objfs     -         no        - 
 sharefs -         /etc/dfs/sharetab         sharefs -         no        - 
 fd        -         /dev/fd fd        -         no        - 
 swap      -         /tmp      tmpfs     -         yes       - 
 data/zone/ngzone/ROOT/zbe-1/svc      -         /lib/svc          zfs       -         no       - 
 data/zone/ngzone/ROOT/zbe-1/fm       -         /usr/lib/fm       zfs       -         no       - 
 </pre> 

Back