diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-18 18:00:41 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 01:37:28 -0400 |
commit | 924cec7789f65ab7f022256f6533ecba0747b5f3 (patch) | |
tree | aeb53f094712161d61990d22fecb0874e4ff3f2a /block/blk-core.c | |
parent | e686307fdc84f249490e6c9da92fcb2424491f14 (diff) |
block: clear req->errors on bio completion only for fs requests
Impact: subtle behavior change
For fs requests, rq is only carrier of bios and rq error status as a
whole doesn't mean much. This is the reason why rq->errors is being
cleared on each partial completion of a request as on each partial
completion the error status is transferred to the respective bios.
For pc requests, rq->errors is used to carry error status to the
issuer and thus __end_that_request_first() doesn't clear it on such
cases.
The condition was fine till now as only fs and pc requests have used
bio and thus the bio completion path. However, future changes will
unify data accesses to bio and all non fs users care about rq error
status. Clear rq->errors on bio completion only for fs requests.
In general, the implicit clearing is a bit too subtle especially as
the meaning of rq->errors is completely dependent on low level
drivers. Unifying / cleaning up rq->errors usage and letting llds
manage it would be better. TODO comment added.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 2998fe3a2377..41bc0ff75e28 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1741,10 +1741,14 @@ static int __end_that_request_first(struct request *req, int error, | |||
1741 | trace_block_rq_complete(req->q, req); | 1741 | trace_block_rq_complete(req->q, req); |
1742 | 1742 | ||
1743 | /* | 1743 | /* |
1744 | * for a REQ_TYPE_BLOCK_PC request, we want to carry any eventual | 1744 | * For fs requests, rq is just carrier of independent bio's |
1745 | * sense key with us all the way through | 1745 | * and each partial completion should be handled separately. |
1746 | * Reset per-request error on each partial completion. | ||
1747 | * | ||
1748 | * TODO: tj: This is too subtle. It would be better to let | ||
1749 | * low level drivers do what they see fit. | ||
1746 | */ | 1750 | */ |
1747 | if (!blk_pc_request(req)) | 1751 | if (blk_fs_request(req)) |
1748 | req->errors = 0; | 1752 | req->errors = 0; |
1749 | 1753 | ||
1750 | if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) { | 1754 | if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) { |