mirror_zfs/module/os/linux/zfs
Prakash Surya 99573cc053 Timeout waiting for ZVOL device to be created
We've seen cases where after creating a ZVOL, the ZVOL device node in
"/dev" isn't generated after 20 seconds of waiting, which is the point
at which our applications gives up on waiting and reports an error.

The workload when this occurs is to "refresh" 400+ ZVOLs roughly at the
same time, based on a policy set by the user. This refresh operation
will destroy the ZVOL, and re-create it based on a snapshot.

When this occurs, we see many hundreds of entries on the "z_zvol" taskq
(based on inspection of the /proc/spl/taskq-all file). Many of the
entries on the taskq end up in the "zvol_remove_minors_impl" function,
and I've measured the latency of that function:

Function = zvol_remove_minors_impl
msecs               : count     distribution
  0 -> 1          : 0        |                                        |
  2 -> 3          : 0        |                                        |
  4 -> 7          : 1        |                                        |
  8 -> 15         : 0        |                                        |
 16 -> 31         : 0        |                                        |
 32 -> 63         : 0        |                                        |
 64 -> 127        : 1        |                                        |
128 -> 255        : 45       |****************************************|
256 -> 511        : 5        |****                                    |

That data is from a 10 second sample, using the BCC "funclatency" tool.
As we can see, in this 10 second sample, most calls took 128ms at a
minimum. Thus, some basic math tells us that in any 20 second interval,
we could only process at most about 150 removals, which is much less
than the 400+ that'll occur based on the workload.

As a result of this, and since all ZVOL minor operations will go through
the single threaded "z_zvol" taskq, the latency for creating a single
ZVOL device can be unreasonably large due to other ZVOL activity on the
system. In our case, it's large enough to cause the application to
generate an error and fail the operation.

When profiling the "zvol_remove_minors_impl" function, I saw that most
of the time in the function was spent off-cpu, blocked in the function
"taskq_wait_outstanding". How this works, is "zvol_remove_minors_impl"
will dispatch calls to "zvol_free" using the "system_taskq", and then
the "taskq_wait_outstanding" function is used to wait for all of those
dispatched calls to occur before "zvol_remove_minors_impl" will return.

As far as I can tell, "zvol_remove_minors_impl" doesn't necessarily have
to wait for all calls to "zvol_free" to occur before it returns. Thus,
this change removes the call to "taskq_wait_oustanding", so that calls
to "zvol_free" don't affect the latency of "zvol_remove_minors_impl".

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Gallagher <john.gallagher@delphix.com>
Signed-off-by: Prakash Surya <prakash.surya@delphix.com>
Closes #9380
2019-10-01 12:33:12 -07:00
..
abd.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
Makefile.in OpenZFS restructuring - zfs_ioctl 2019-09-27 10:46:28 -07:00
policy.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
qat_compress.c QAT related bug fixes 2019-09-12 13:33:44 -07:00
qat_crypt.c QAT related bug fixes 2019-09-12 13:33:44 -07:00
qat.c QAT related bug fixes 2019-09-12 13:33:44 -07:00
spa_stats.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
trace.c OpenZFS restructuring - move linux tracing code to platform directories 2019-09-11 14:25:53 -07:00
vdev_disk.c Add warning for zfs_vdev_elevator option removal 2019-09-25 09:23:29 -07:00
vdev_file.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_acl.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_ctldir.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_debug.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_dir.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_ioctl_os.c OpenZFS restructuring - zfs_ioctl 2019-09-27 10:46:28 -07:00
zfs_sysfs.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_vfsops.c Move objnode handling to common code 2019-09-12 13:31:09 -07:00
zfs_vnops.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zfs_znode.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zio_crypt.c Enable SIMD for encryption 2019-09-10 10:45:46 -07:00
zpl_ctldir.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zpl_export.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zpl_file.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zpl_inode.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zpl_super.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zpl_xattr.c OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
zvol_os.c Timeout waiting for ZVOL device to be created 2019-10-01 12:33:12 -07:00