mutex_lock(&dev->cache.rb_lock);
        for (node = rb_first(root); node; node = rb_next(node)) {
                ent = rb_entry(node, struct mlx5_cache_ent, node);
 -              xa_lock_irq(&ent->mkeys);
 +              spin_lock_irq(&ent->mkeys_queue.lock);
                ent->disabled = true;
 -              xa_unlock_irq(&ent->mkeys);
 +              spin_unlock_irq(&ent->mkeys_queue.lock);
-               cancel_delayed_work_sync(&ent->dwork);
        }
+       mutex_unlock(&dev->cache.rb_lock);
+ 
+       /*
+        * After all entries are disabled and will not reschedule on WQ,
+        * flush it and all async commands.
+        */
+       flush_workqueue(dev->cache.wq);
  
        mlx5_mkey_cache_debugfs_cleanup(dev);
        mlx5_cmd_cleanup_async_ctx(&dev->async_ctx);