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

From: Jens Axboe
Date: Mon Oct 18 2010 - 08:22:09 EST


On 2010-10-18 14:19, Yasuaki Ishimatsu wrote:
> Hi Jens,
>
> Jens Axboe wrote:
>> 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?
>
> Ah...
> I misunderstood the purpose of the call_rcu().
> I moved elv_quiesce_end() to the rcu callback.

This version looks good, thanks for following through on this. What kind
of testing did you do?

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/