Commit fe1659c1 authored by Andrew Morton's avatar Andrew Morton Committed by Jens Axboe

[PATCH] direct-io return value fix

If at the end of direct_io_worker, dio->result is non-zero then we
unconditionally copy that into the return value, potentially ignoring any I/O
errors which were accumulated into local variable `ret'.

Only do the assignment if `ret' is zero.
parent b3d9f279
......@@ -927,20 +927,17 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
ret = dio->result; /* Bytes written */
finished_one_bio(dio); /* This can free the dio */
blk_run_queues();
goto out;
} else {
finished_one_bio(dio);
ret2 = dio_await_completion(dio);
if (ret == 0)
ret = ret2;
if (ret == 0)
ret = dio->page_errors;
if (ret == 0 && dio->result)
ret = dio->result;
kfree(dio);
}
finished_one_bio(dio);
ret2 = dio_await_completion(dio);
if (ret == 0)
ret = ret2;
if (ret == 0)
ret = dio->page_errors;
if (dio->result)
ret = dio->result;
kfree(dio);
out:
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment