Skip to content

Commit

Permalink
dm: fix ioctl retry termination with signal
Browse files Browse the repository at this point in the history
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
6c182cd ("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: 6c182cd ("dm mpath: fix ioctl deadlock when no paths")
Signed-off-by: Jun'ichi Nomura <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
Cc: [email protected]
  • Loading branch information
nomuranec authored and snitm committed Nov 17, 2015
1 parent 172c238 commit 5bbbfdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ static int multipath_prepare_ioctl(struct dm_target *ti,

spin_unlock_irqrestore(&m->lock, flags);

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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ static int dm_get_live_table_for_ioctl(struct mapped_device *md,

out:
dm_put_live_table(md, *srcu_idx);
if (r == -ENOTCONN) {
if (r == -ENOTCONN && !fatal_signal_pending(current)) {
msleep(10);
goto retry;
}
Expand Down

0 comments on commit 5bbbfdf

Please sign in to comment.