dm mpath: allow ioctls to trigger pg init
authorMikulas Patocka <mpatocka@redhat.com>
Sat, 2 Jun 2012 23:29:58 +0000 (00:29 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Sat, 2 Jun 2012 23:29:58 +0000 (00:29 +0100)
commit35991652baa12ff3d0e420c0d0cb2ad9f7076e5b
tree82d6d2bbd03be95dfb91e0678a94b613cbfc28ae
parentf220fd4efb334a772f9a14b2372175f38d89355e
dm mpath: allow ioctls to trigger pg init

After the failure of a group of paths, any alternative paths that
need initialising do not become available until further I/O is sent to
the device.  Until this has happened, ioctls return -EAGAIN.

With this patch, new paths are made available in response to an ioctl
too.  The processing of the ioctl gets delayed until this has happened.

Instead of returning an error, we submit a work item to kmultipathd
(that will potentially activate the new path) and retry in ten
milliseconds.

Note that the patch doesn't retry an ioctl if the ioctl itself fails due
to a path failure.  Such retries should be handled intelligently by the
code that generated the ioctl in the first place, noting that some SCSI
commands should not be retried because they are not idempotent (XOR write
commands).  For commands that could be retried, there is a danger that
if the device rejected the SCSI command, the path could be errorneously
marked as failed, and the request would be retried on another path which
might fail too.  It can be determined if the failure happens on the
device or on the SCSI controller, but there is no guarantee that all
SCSI drivers set these flags correctly.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-mpath.c