The "request->timeout_list" is under the risk of modified by both timeout
(abort handler) and a "finishing" handler. Using bit REQ_ATOM_COMPLETE in
atomic_flags as a guard to shield this issue.

Signed-off-by: Liu Ping Fan <pingf...@linux.vnet.ibm.com>
---
 block/blk-timeout.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 7a882f7..d3067f0 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -120,13 +120,14 @@ void blk_rq_check_expired(struct request *rq, unsigned 
long *next_timeout,
                          unsigned int *next_set)
 {
        if (time_after_eq(jiffies, rq->deadline)) {
-               list_del_init(&rq->timeout_list);
 
                /*
                 * Check if we raced with end io completion
                 */
-               if (!blk_mark_rq_complete(rq))
+               if (!blk_mark_rq_complete(rq)) {
+                       list_del_init(&rq->timeout_list);
                        blk_rq_timed_out(rq);
+               }
        } else if (!*next_set || time_after(*next_timeout, rq->deadline)) {
                *next_timeout = rq->deadline;
                *next_set = 1;
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to