]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
blk-mq: silence false positive warnings in hctx_unlock()
authorJens Axboe <axboe@kernel.dk>
Fri, 10 Jan 2020 23:24:00 +0000 (00:24 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 14 Feb 2020 11:48:31 +0000 (12:48 +0100)
commit76da92ce7f16796ac1ad785af565d04c9f85b900
treea44efc79ce5cd8ef66da0d37ca46487e56a3adef
parentce0108d298bd20011c5557fd77a8d7973fa245c6
blk-mq: silence false positive warnings in hctx_unlock()

BugLink: https://bugs.launchpad.net/bugs/1848739
In some stupider versions of gcc, it complains:

block/blk-mq.c: In function ‘blk_mq_complete_request’:
./include/linux/srcu.h:175:2: warning: ‘srcu_idx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  __srcu_read_unlock(sp, idx);
  ^
block/blk-mq.c:620:6: note: ‘srcu_idx’ was declared here
  int srcu_idx;
      ^

which is completely bogus, since we only use srcu_idx when
hctx->flags & BLK_MQ_F_BLOCKING is set, and that's the case where
hctx_lock() has initialized it.

Just set it to '0' in the normal path in hctx_lock() to silence
this annoying warning.

Fixes: 04ced159cec8 ("blk-mq: move hctx lock/unlock into a helper")
Fixes: 5197c05e16b4 ("blk-mq: protect completion path with RCU")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(backported from commit 08b5a6e2a769f720977b245431b45134c0bdd377)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
block/blk-mq.c