Do not return /dev/loop-control in unused_loop_device
authorAndrew Reid <ColdCanuck@nailedtotheperch.com>
Sat, 13 Oct 2012 15:03:59 +0000 (12:03 -0300)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 15 Oct 2012 17:02:42 +0000 (10:02 -0700)
commit6cb7ab069d9079a5b4b955da883d5ab804c91319
treea51f0ee284193f78201821e0d39efe6b5423dc3b
parent6f53a6a2299688b092f8183354a4cc159e3eed20
Do not return /dev/loop-control in unused_loop_device

The function unused_loop_device in /usr/libexec/zfs/common.sh
returns /dev/loop-control on the first call. This device is NOT
a loop device (https://github.com/torvalds/linux/commit/770fe30)
it is a control device. This in turn causes the script zconfig.sh
to fail with:

  zpool-create.sh: Error 1 creating /tmp/zpool-vdev0 ->
  /dev/loop-control loopback

The patch makes the function return /dev/loop[0-9]* which are
loop devices.

Signed-off-by: Andrew Reid <ColdCanuck@nailedtotheperch.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #797
scripts/common.sh.in