diff options
Diffstat (limited to 'block/blk-ioc.c')
-rw-r--r-- | block/blk-ioc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index 92bf55540d87..fb95dd2f889a 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -130,6 +130,7 @@ static void ioc_release_fn(struct work_struct *work) | |||
130 | void put_io_context(struct io_context *ioc) | 130 | void put_io_context(struct io_context *ioc) |
131 | { | 131 | { |
132 | unsigned long flags; | 132 | unsigned long flags; |
133 | bool free_ioc = false; | ||
133 | 134 | ||
134 | if (ioc == NULL) | 135 | if (ioc == NULL) |
135 | return; | 136 | return; |
@@ -144,8 +145,13 @@ void put_io_context(struct io_context *ioc) | |||
144 | spin_lock_irqsave(&ioc->lock, flags); | 145 | spin_lock_irqsave(&ioc->lock, flags); |
145 | if (!hlist_empty(&ioc->icq_list)) | 146 | if (!hlist_empty(&ioc->icq_list)) |
146 | schedule_work(&ioc->release_work); | 147 | schedule_work(&ioc->release_work); |
148 | else | ||
149 | free_ioc = true; | ||
147 | spin_unlock_irqrestore(&ioc->lock, flags); | 150 | spin_unlock_irqrestore(&ioc->lock, flags); |
148 | } | 151 | } |
152 | |||
153 | if (free_ioc) | ||
154 | kmem_cache_free(iocontext_cachep, ioc); | ||
149 | } | 155 | } |
150 | EXPORT_SYMBOL(put_io_context); | 156 | EXPORT_SYMBOL(put_io_context); |
151 | 157 | ||