summaryrefslogtreecommitdiff
path: root/block/elevator.c
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2015-12-10 17:38:22 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:02:02 -0700
commit09ed2d9d3c0ab163954d5bd605c84ddfc76f1a99 (patch)
tree7239925f90955cc202d2e86531c4fc818678acf6 /block/elevator.c
parenta627c73479155f8f0328d7bb1d0b8c9e17b7aa88 (diff)
block: don't allow nr_pending to go negative
nr_pending can go negative if we attempt to decrement it without matching increment call earlier. If nr_pending goes negative, LLD's runtime suspend might race with the ongoing request. This change allows decrementing nr_pending only if it is non-zero. Change-Id: I5f1e93ab0e0f950307e2e3c4f95c7cb01e83ffdd Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/elevator.c b/block/elevator.c
index c3555c9c672f..226a7d84470d 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -538,7 +538,7 @@ void elv_bio_merged(struct request_queue *q, struct request *rq,
#ifdef CONFIG_PM
static void blk_pm_requeue_request(struct request *rq)
{
- if (rq->q->dev && !(rq->cmd_flags & REQ_PM))
+ if (rq->q->dev && !(rq->cmd_flags & REQ_PM) && rq->q->nr_pending)
rq->q->nr_pending--;
}