On 8/1/19 4:21 AM, Damien Le Moal wrote:
> The recent fix to properly handle IOCB_NOWAIT for async O_DIRECT IO
> (patch 6a43074e2f46) introduced two problems with BIO fragment handling
> for direct IOs:
> 1) The dio size processed is claculated by incrementing the ret variable
> by the size of the bio fragment issued for the dio. However, this size
> is obtained directly from bio->bi_iter.bi_size AFTER the bio submission
> which may result in referencing the bi_size value after the bio
> completed, resulting in an incorrect value use.
> 2) The ret variable is not incremented by the size of the last bio
> fragment issued for the bio, leading to an invalid IO size being
> returned to the user.
> 
> Fix both problem by using dio->size (which is incremented before the bio
> submission) to update the value of ret after bio submissions, including
> for the last bio fragment issued.

Thanks, applied. Do you have a test case? I ran this through the usual
xfstests and block bits, but didn't catch anything.

-- 
Jens Axboe

Reply via email to