]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/core/fmr_pool.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / drivers / infiniband / core / fmr_pool.c
index 4044fdf62cc2d92210a4639ce2bb40be158d9b82..1286dc1b98b2acda72ce158ef8abd443cc3c8dc1 100644 (file)
@@ -158,8 +158,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
 #endif
        }
 
-       list_splice(&pool->dirty_list, &unmap_list);
-       INIT_LIST_HEAD(&pool->dirty_list);
+       list_splice_init(&pool->dirty_list, &unmap_list);
        pool->dirty_len = 0;
 
        spin_unlock_irq(&pool->pool_lock);
@@ -398,8 +397,23 @@ EXPORT_SYMBOL(ib_destroy_fmr_pool);
  */
 int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
 {
-       int serial = atomic_inc_return(&pool->req_ser);
+       int serial;
+       struct ib_pool_fmr *fmr, *next;
+
+       /*
+        * The free_list holds FMRs that may have been used
+        * but have not been remapped enough times to be dirty.
+        * Put them on the dirty list now so that the cleanup
+        * thread will reap them too.
+        */
+       spin_lock_irq(&pool->pool_lock);
+       list_for_each_entry_safe(fmr, next, &pool->free_list, list) {
+               if (fmr->remap_count > 0)
+                       list_move(&fmr->list, &pool->dirty_list);
+       }
+       spin_unlock_irq(&pool->pool_lock);
 
+       serial = atomic_inc_return(&pool->req_ser);
        wake_up_process(pool->thread);
 
        if (wait_event_interruptible(pool->force_wait,