sbin/hammer: Abort if a device is used for more than one volumes
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 14 Jun 2015 04:22:56 +0000 (13:22 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 14 Jun 2015 16:37:57 +0000 (01:37 +0900)
commit06acdb69d31b793b62338342b7d448d520c0ed89
tree453f5eae7bc32c8ac4f5d2800ecce1457761bf93
parent91b50a91158595de1942a4a196f595a5c82bcbeb
sbin/hammer: Abort if a device is used for more than one volumes

- setup_volume() needs to check if the device has already been
  registered, in addition to checking the volume id. If it's been
  registered already, abort the process before writes to volumes
  start. Otherwise using a single device for more than one volumes
  hits assertion at some point on blockmap lookup of layer1/2
  bigblocks with possible core dump. It should abort before any
  ondisk change (when the function is used by newfs_hammer) occurs.

  # /sbin/newfs_hammer -L TEST /dev/da3 /dev/da3 /dev/da3
  Volume 0 DEVICE /dev/da3        size 465.76GB
  newfs_hammer: setup_volume: /dev/da3: Specified more than once
sbin/hammer/ondisk.c