Fix possible VDEV stats array overflow

Fix a possible VDEV statistics array overflow when ZIOs with
ZIO_PRIORITY_NOW complete.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4883
Closes #4917
This commit is contained in:
Tony Hutter 2016-08-01 17:32:18 -07:00 committed by Brian Behlendorf
parent e24e62a948
commit 4eb0db42d3
1 changed files with 2 additions and 1 deletions

View File

@ -2982,7 +2982,8 @@ vdev_stat_update(zio_t *zio, uint64_t psize)
* The bytes/ops/histograms are recorded at the leaf level and
* aggregated into the higher level vdevs in vdev_get_stats().
*/
if (vd->vdev_ops->vdev_op_leaf) {
if (vd->vdev_ops->vdev_op_leaf &&
(zio->io_priority < ZIO_PRIORITY_NUM_QUEUEABLE)) {
vs->vs_ops[type]++;
vs->vs_bytes[type] += psize;