summaryrefslogtreecommitdiffstats
path: root/block/blk-merge.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-06-20 11:15:45 -0700
committerJens Axboe <axboe@kernel.dk>2017-06-20 19:27:14 -0600
commit2fff8a924d4c614b5a17b2a236a2cf09aa51af5f (patch)
tree46f7b27ff3593ddeabaadd0032e5449825995fde /block/blk-merge.c
parent9e0c829906b9aa1e7ad84689f2bcd56457bdb417 (diff)
downloadlinux-stable-2fff8a924d4c614b5a17b2a236a2cf09aa51af5f.tar.gz
linux-stable-2fff8a924d4c614b5a17b2a236a2cf09aa51af5f.tar.bz2
linux-stable-2fff8a924d4c614b5a17b2a236a2cf09aa51af5f.zip
block: Check locking assumptions at runtime
Instead of documenting the locking assumptions of most block layer functions as a comment, use lockdep_assert_held() to verify locking assumptions at runtime. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Omar Sandoval <osandov@fb.com> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r--block/blk-merge.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index cea544ec5d96..5df13041b851 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -648,6 +648,9 @@ static void blk_account_io_merge(struct request *req)
static struct request *attempt_merge(struct request_queue *q,
struct request *req, struct request *next)
{
+ if (!q->mq_ops)
+ lockdep_assert_held(q->queue_lock);
+
if (!rq_mergeable(req) || !rq_mergeable(next))
return NULL;