Commit cb2ccb2e authored by Junichi Nomura's avatar Junichi Nomura Committed by Kamal Mostafa

dm: fix ioctl retry termination with signal

commit 5bbbfdf6 upstream.

dm-mpath retries ioctl, when no path is readily available and the device
is configured to queue I/O in such a case. If you want to stop the retry
before multipathd decides to turn off queueing mode, you could send
signal for the process to exit from the loop.

However the check of fatal signal has not carried along when commit
6c182cd8 ("dm mpath: fix ioctl deadlock when no paths") moved the
loop from dm-mpath to dm core. As a result, we can't terminate such
a process in the retry loop.

Easy reproducer of the situation is:

  # dmsetup create mp --table '0 1024 multipath 0 0 0 0'
  # dmsetup message mp 0 'queue_if_no_path'
  # sg_inq /dev/mapper/mp

then you should be able to terminate sg_inq by pressing Ctrl+C.

Fixes: 6c182cd8 ("dm mpath: fix ioctl deadlock when no paths")
Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 4c747e03
......@@ -1629,7 +1629,7 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)
r = scsi_verify_blk_ioctl(NULL, cmd);
if (r == -ENOTCONN && !fatal_signal_pending(current))
if (r == -ENOTCONN)
queue_work(kmultipathd, &m->process_queued_ios);
return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
......
......@@ -530,7 +530,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
out:
dm_put_live_table(md, srcu_idx);
if (r == -ENOTCONN) {
if (r == -ENOTCONN && !fatal_signal_pending(current)) {
msleep(10);
goto retry;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment