]> git.proxmox.com Git - mirror_zfs.git/commit
Use udev for partition detection
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 19 Apr 2016 18:19:12 +0000 (11:19 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 25 Apr 2016 18:13:20 +0000 (11:13 -0700)
commit2d82ea8b111103b28b8c9ad0f69dd88736248804
treec132339412ce0ed9b8f04c6ccb6471317755f59c
parent5b4136bd499a892f65c86af8fd39fa21e05c9148
Use udev for partition detection

When ZFS partitions a block device it must wait for udev to create
both a device node and all the device symlinks.  This process takes
a variable length of time and depends on factors such how many links
must be created, the complexity of the rules, etc.  Complicating
the situation further it is not uncommon for udev to create and
then remove a link multiple times while processing the udev rules.

Given the above, the existing scheme of waiting for an expected
partition to appear by name isn't 100% reliable.  At this point
udev may still remove and recreate think link resulting in the
kernel modules being unable to open the device.

In order to address this the zpool_label_disk_wait() function
has been updated to use libudev.  Until the registered system
device acknowledges that it in fully initialized the function
will wait.  Once fully initialized all device links are checked
and allowed to settle for 50ms.  This makes it far more likely
that all the device nodes will exist when the kernel modules
need to open them.

For systems without libudev an alternate zpool_label_disk_wait()
was updated to include a settle time.  In addition, the kernel
modules were updated to include retry logic for this ENOENT case.
Due to the improved checks in the utilities it is unlikely this
logic will be invoked.  However, if the rare event it is needed
it will prevent a failure.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Richard Laager <rlaager@wiktel.com>
Closes #4523
Closes #3708
Closes #4077
Closes #4144
Closes #4214
Closes #4517
cmd/zpool/zpool_vdev.c
lib/libzfs/libzfs_import.c
lib/libzfs/libzfs_pool.c
module/zfs/vdev_disk.c