]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm: fix ioctl retry termination with signal
authorJunichi Nomura <j-nomura@ce.jp.nec.com>
Tue, 17 Nov 2015 09:39:26 +0000 (09:39 +0000)
committerLuis Henriques <luis.henriques@canonical.com>
Fri, 18 Dec 2015 16:06:27 +0000 (16:06 +0000)
commit 5bbbfdf685657771fda05b926b28ca0f79163a28 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
6c182cd88d17 ("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: 6c182cd88d17 ("dm mpath: fix ioctl deadlock when no paths")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/md/dm-mpath.c
drivers/md/dm.c

index 43e2b498732fae5a89ae68388e54bee735726226..34601cc0c5086c068c105cce3e4e60bd714a59ab 100644 (file)
@@ -1548,7 +1548,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) {
                spin_lock_irqsave(&m->lock, flags);
                if (!m->current_pg) {
                        /* Path status changed, redo selection */
index 91b2394897857ecfd402863f837b4643ccc808ab..f62d4c8bd9f947fab4522f6e392c9e9161fcd874 100644 (file)
@@ -528,7 +528,7 @@ retry:
 out:
        dm_put_live_table(md, srcu_idx);
 
-       if (r == -ENOTCONN) {
+       if (r == -ENOTCONN && !fatal_signal_pending(current)) {
                msleep(10);
                goto retry;
        }