Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Tue, 30 Nov 2010 18:01:18 +0100 | From | Jerome Marchand <> | Subject | Re: [GIT PULL] Revert of the IO stat fix |
| |
On 10/24/2010 10:44 PM, Jens Axboe wrote: > diff --git a/block/genhd.c b/block/genhd.c > index a8adf96..7d4d860 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -930,14 +930,9 @@ static void disk_free_ptbl_rcu_cb(struct rcu_head *head) > struct disk_part_tbl *ptbl = > container_of(head, struct disk_part_tbl, rcu_head); > struct gendisk *disk = ptbl->disk; > - struct request_queue *q = disk->queue; > - unsigned long flags; > > kfree(ptbl); > - > - spin_lock_irqsave(q->queue_lock, flags); > - elv_quiesce_end(q); > - spin_unlock_irqrestore(q->queue_lock, flags); > + elv_quiesce_end(disk->queue);
Here, the queue may be already gone. We should check it is still here and alive:
static void disk_free_ptbl_rcu_cb(struct rcu_head *head) { struct disk_part_tbl *ptbl = container_of(head, struct disk_part_tbl, rcu_head); struct gendisk *disk = ptbl->disk; struct request_queue *q = disk->queue;
kfree(ptbl); if (q && !test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) elv_quiesce_end(q); }
> } > > /** > @@ -962,10 +957,7 @@ static void disk_replace_part_tbl(struct gendisk *disk, > if (old_ptbl) { > rcu_assign_pointer(old_ptbl->last_lookup, NULL); > > - spin_lock_irq(q->queue_lock); > elv_quiesce_start(q);
Same as above.
I'm not sure that is enough, but on my test machine these changes fix the crash at USB key device removal.
Regards, Jerome
> - spin_unlock_irq(q->queue_lock); > - > call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb); > } > }
| ![\](/images/icornerr.gif) |