[PATCH] blk-mq: don't clear RQF_MQ_INFLIGHT in blk_mq_rq_ctx_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of no IO scheduler, RQF_MQ_INFLIGHT is set in blk_mq_rq_ctx_init(),
but 7c3fb70f0341 clears it mistakenly, so fix it.

This patch fixes systemd-udevd hang when starting multipathd service:

[  914.409660] systemd-journald[213]: Successfully sent stream file descriptor to service manager.
[  984.028104] INFO: task systemd-udevd:1518 blocked for more than 120 seconds.
[  984.030916]       Not tainted 4.15.0-rc6+ #62
[  984.032709] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  984.035818] systemd-udevd   D    0  1518    232 0x80000006
[  984.035826] Call Trace:
[  984.035846]  ? __schedule+0x626/0x759
[  984.035855]  schedule+0x88/0x9b
[  984.035861]  io_schedule+0x12/0x33
[  984.035867]  __lock_page+0xef/0x127
[  984.035874]  ? add_to_page_cache_lru+0xd4/0xd4
[  984.035889]  truncate_inode_pages_range+0x533/0x62f
[  984.035929]  ? cpumask_next+0x17/0x18
[  984.035937]  ? cpumask_next+0x17/0x18
[  984.035943]  ? smp_call_function_many+0x1e4/0x218
[  984.035949]  ? __find_get_block+0x2ba/0x2ba
[  984.035961]  ? __find_get_block+0x216/0x2ba
[  984.035977]  ? on_each_cpu_cond+0xbf/0x143
[  984.035992]  __blkdev_put+0x69/0x1a5
[  984.036009]  blkdev_close+0x21/0x24
[  984.036025]  __fput+0xdb/0x18a
[  984.036039]  task_work_run+0x6f/0x80
[  984.036048]  do_exit+0x452/0x96b
[  984.036055]  ? preempt_count_add+0x7a/0x8c
[  984.036061]  do_group_exit+0x3c/0x98
[  984.036067]  get_signal+0x47c/0x4fd
[  984.036076]  do_signal+0x36/0x51f
[  984.036090]  exit_to_usermode_loop+0x3a/0x73
[  984.036096]  syscall_return_slowpath+0x97/0xcf
[  984.036103]  entry_SYSCALL_64_fastpath+0x7b/0x7d
[  984.036109] RIP: 0033:0x7f2ffce94540
[  984.036112] RSP: 002b:00007ffffd1cb888 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[  984.036117] RAX: fffffffffffffffc RBX: 000055d9840e72d0 RCX: 00007f2ffce94540
[  984.036120] RDX: 0000000000000018 RSI: 000055d9840e72f8 RDI: 0000000000000007
[  984.036122] RBP: 000055d984111860 R08: 000055d9840e72d0 R09: 0000000000000092
[  984.036125] R10: 00007f2ffce7ebb8 R11: 0000000000000246 R12: 0000000000000018
[  984.036127] R13: 000000020014e200 R14: 000055d9841118b0 R15: 000055d9840e72e8
[ 1034.410125] systemd-journald[213]: Sent WATCHDOG=1 notification.

Cc: Laurence Oberman <loberman@xxxxxxxxxx>
Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
Fixes: 7c3fb70f0341 ("block: rearrange a few request fields for better cache layout")
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 block/blk-mq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index ef9beca2d117..c1c74d891ce7 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -269,13 +269,14 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
 {
 	struct blk_mq_tags *tags = blk_mq_tags_from_data(data);
 	struct request *rq = tags->static_rqs[tag];
+	bool inflight = false;
 
 	if (data->flags & BLK_MQ_REQ_INTERNAL) {
 		rq->tag = -1;
 		rq->internal_tag = tag;
 	} else {
 		if (blk_mq_tag_busy(data->hctx)) {
-			rq->rq_flags = RQF_MQ_INFLIGHT;
+			inflight = true;
 			atomic_inc(&data->hctx->nr_active);
 		}
 		rq->tag = tag;
@@ -286,7 +287,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
 	/* csd/requeue_work/fifo_time is initialized before use */
 	rq->q = data->q;
 	rq->mq_ctx = data->ctx;
-	rq->rq_flags = 0;
+	rq->rq_flags = inflight ? RQF_MQ_INFLIGHT : 0;
 	rq->cpu = -1;
 	rq->cmd_flags = op;
 	if (data->flags & BLK_MQ_REQ_PREEMPT)
-- 
2.9.5




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux