>> +static int wait_for_more_bios(struct dio *dio)
>> +{
>> + assert_spin_locked(&dio->bio_lock);
>> +
>> + return (atomic_read(&dio->refcount) > 1) && (dio->bio_list == NULL);
>> +}
>
> This function isn't well-named.
Sure, I'll try harder.
>
>> @@ -1103,7 +1088,11 @@ direct_io_worker(int rw, struct kiocb *i
>> }
>> if (ret == 0)
>> ret = dio->result;
>> - finished_one_bio(dio); /* This can free the dio */
>> +
>> + /* this can free the dio */
>> + if (atomic_dec_and_test(&dio->refcount))
>> + dio_complete_aio(dio);
>
> So... how come it's legitimate to touch *dio if it can be freed by now?
Indeed! This point in the patchset is retaining the existing behaviour
where the 'should_wait' direct_io_worker() path and the
finished_one_bio() path very carefully keep their tests in sync so that
only one of them ends up freeing the dio.
This particular patch doesn't change this part of the behaviour, it's
just bringing the dec and complete that was previously hidden in
finished_one_bio() up into its caller. So I kept the comment.
This mess is replaced with a proper
if (dec_and_test(dio->refcount))
kfree(dio)
construct in the final patch. I hope that means we don't need to patch
in some comments that we later remove.
- z
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]