]> granicus.if.org Git - zfs/commitdiff
Fix coverity defects: CID 150924
authorluozhengzheng <luo.zhengzheng@zte.com.cn>
Mon, 17 Oct 2016 19:03:52 +0000 (03:03 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 17 Oct 2016 19:03:52 +0000 (12:03 -0700)
CID 150924: Unchecked return value (CHECKED_RETURN)
- On taskq_dispatch failure the reference must be dropped and
  this entry can be safely skipped.  This case should be impossible
  in the existing implementation but should be handled regardless.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5278

module/zfs/arc.c

index 7bae2c42d26d10f83bb250bb668edb0e1435b33c..0c5e66cbeb42c6de4a95c28c6b50c381044dd3aa 100644 (file)
@@ -3472,7 +3472,11 @@ arc_prune_async(int64_t adjust)
 
                refcount_add(&ap->p_refcnt, ap->p_pfunc);
                ap->p_adjust = adjust;
-               taskq_dispatch(arc_prune_taskq, arc_prune_task, ap, TQ_SLEEP);
+               if (taskq_dispatch(arc_prune_taskq, arc_prune_task,
+                   ap, TQ_SLEEP) == 0) {
+                       refcount_remove(&ap->p_refcnt, ap->p_pfunc);
+                       continue;
+               }
                ARCSTAT_BUMP(arcstat_prune);
        }
        mutex_exit(&arc_prune_mtx);