Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
[sfrench/cifs-2.6.git] / mm / mempool.c
index 7bf064e6a345e898a5eafc616cd691b50fbedcec..ccd8cb8cd41f59fc19e2198bfb2862ad72d62ff9 100644 (file)
@@ -183,8 +183,8 @@ EXPORT_SYMBOL(mempool_resize);
  */
 void mempool_destroy(mempool_t *pool)
 {
-       if (pool->curr_nr != pool->min_nr)
-               BUG();          /* There were outstanding elements */
+       /* Check for outstanding elements */
+       BUG_ON(pool->curr_nr != pool->min_nr);
        free_pool(pool);
 }
 EXPORT_SYMBOL(mempool_destroy);
@@ -238,8 +238,13 @@ repeat_alloc:
        init_wait(&wait);
        prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
        smp_mb();
-       if (!pool->curr_nr)
-               io_schedule();
+       if (!pool->curr_nr) {
+               /*
+                * FIXME: this should be io_schedule().  The timeout is there
+                * as a workaround for some DM problems in 2.6.18.
+                */
+               io_schedule_timeout(5*HZ);
+       }
        finish_wait(&pool->wait, &wait);
 
        goto repeat_alloc;