diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-02-01 03:44:28 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-02-01 03:44:28 -0500 |
commit | 8bdd3f8a6993fef2f364aca6e1a59559405773a2 (patch) | |
tree | cbf07985c3396417932002be5cd5e4f2c47433e9 | |
parent | 4f4f6c2502474f51654a699d7127d86c2f87075a (diff) |
as-iosched: fix inconsistent ioc->lock context
Since it's acquired from irq context, all locking must be of the
irq safe variant. Most are already inside the queue lock (which
already disables interrupts), but the io scheduler rmmod path
always has irqs enabled and the put_io_context() path may legally
be called with irqs enabled (even if it isn't usually). So fixup
those two.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/as-iosched.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c index 96036846a001..612d64096300 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
@@ -170,11 +170,11 @@ static void free_as_io_context(struct as_io_context *aic) | |||
170 | 170 | ||
171 | static void as_trim(struct io_context *ioc) | 171 | static void as_trim(struct io_context *ioc) |
172 | { | 172 | { |
173 | spin_lock(&ioc->lock); | 173 | spin_lock_irq(&ioc->lock); |
174 | if (ioc->aic) | 174 | if (ioc->aic) |
175 | free_as_io_context(ioc->aic); | 175 | free_as_io_context(ioc->aic); |
176 | ioc->aic = NULL; | 176 | ioc->aic = NULL; |
177 | spin_unlock(&ioc->lock); | 177 | spin_unlock_irq(&ioc->lock); |
178 | } | 178 | } |
179 | 179 | ||
180 | /* Called when the task exits */ | 180 | /* Called when the task exits */ |
@@ -235,10 +235,12 @@ static void as_put_io_context(struct request *rq) | |||
235 | aic = RQ_IOC(rq)->aic; | 235 | aic = RQ_IOC(rq)->aic; |
236 | 236 | ||
237 | if (rq_is_sync(rq) && aic) { | 237 | if (rq_is_sync(rq) && aic) { |
238 | spin_lock(&aic->lock); | 238 | unsigned long flags; |
239 | |||
240 | spin_lock_irqsave(&aic->lock, flags); | ||
239 | set_bit(AS_TASK_IORUNNING, &aic->state); | 241 | set_bit(AS_TASK_IORUNNING, &aic->state); |
240 | aic->last_end_request = jiffies; | 242 | aic->last_end_request = jiffies; |
241 | spin_unlock(&aic->lock); | 243 | spin_unlock_irqrestore(&aic->lock, flags); |
242 | } | 244 | } |
243 | 245 | ||
244 | put_io_context(RQ_IOC(rq)); | 246 | put_io_context(RQ_IOC(rq)); |