Re: [PATCH v4] blk: fix a wrong accounting of hd_struct->in_flight

Jens Axboe
2010-10-18T08:35:03Z

On 2010-10-18 10:28, Yasuaki Ishimatsu wrote:
> Hi Jens,
>
>> This looks good! To quiesce the queue, something like the below.
>> Completely untested.
>
> Thank you for your advice.
> I applied your idea to the patch.

But you changed it, though:

> if (old_ptbl) {
> rcu_assign_pointer(old_ptbl->last_lookup, NULL);
> + spin_lock_irq(q->queue_lock);
> + elv_quiesce_start(q);
> call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
> + elv_quiesce_end(q);
> + spin_unlock_irq(q->queue_lock);
> }
> }

That is not going to work. The point is to start the drain period
before, then end it when the callback has gone through. By placing it
just after the call_rcu() call, there's no guarentee that the RCU grace
period has elapsed. That is why I placed it inside the rcu callback. Why
did you move it?

For the above to work, you'd need to use synchronize_rcu() instead.

--
Jens Axboe