1. 27 9月, 2012 1 次提交
    • M
      dm mpath: only retry ioctl when no paths if queue_if_no_path set · 7ba10aa6
      Mike Snitzer 提交于
      When there are no paths and multipath receives an ioctl, it waits until
      a path becomes available.  This behaviour is incorrect if the
      "queue_if_no_path" setting was not specified, as then the ioctl should
      be rejected immediately, which this patch now does.
      
      commit 35991652 ("dm mpath: allow ioctls to trigger pg init") should
      have checked if queue_if_no_path was configured before queueing IO.
      
      Checking for the queue_if_no_path feature, like is done in map_io(),
      allows the following table load to work without blocking in the
      multipath_ioctl retry loop:
      
        echo "0 1024 multipath 0 0 0 0" | dmsetup create mpath_nodevs
      
      Without this fix the multipath_ioctl will block with the following stack
      trace:
      
        blkid           D 0000000000000002     0 23936      1 0x00000000
         ffff8802b89e5cd8 0000000000000082 ffff8802b89e5fd8 0000000000012440
         ffff8802b89e4010 0000000000012440 0000000000012440 0000000000012440
         ffff8802b89e5fd8 0000000000012440 ffff88030c2aab30 ffff880325794040
        Call Trace:
         [<ffffffff814ce099>] schedule+0x29/0x70
         [<ffffffff814cc312>] schedule_timeout+0x182/0x2e0
         [<ffffffff8104dee0>] ? lock_timer_base+0x70/0x70
         [<ffffffff814cc48e>] schedule_timeout_uninterruptible+0x1e/0x20
         [<ffffffff8104f840>] msleep+0x20/0x30
         [<ffffffffa0000839>] multipath_ioctl+0x109/0x170 [dm_multipath]
         [<ffffffffa06bfb9c>] dm_blk_ioctl+0xbc/0xd0 [dm_mod]
         [<ffffffff8122a408>] __blkdev_driver_ioctl+0x28/0x30
         [<ffffffff8122a79e>] blkdev_ioctl+0xce/0x730
         [<ffffffff811970ac>] block_ioctl+0x3c/0x40
         [<ffffffff8117321c>] do_vfs_ioctl+0x8c/0x340
         [<ffffffff81166293>] ? sys_newfstat+0x33/0x40
         [<ffffffff81173571>] sys_ioctl+0xa1/0xb0
         [<ffffffff814d70a9>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # 3.5+
      Acked-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      7ba10aa6
  2. 27 7月, 2012 2 次提交
    • A
      dm thin: commit before gathering status · 1f4e0ff0
      Alasdair G Kergon 提交于
      Commit outstanding metadata before returning the status for a dm thin
      pool so that the numbers reported are as up-to-date as possible.
      
      The commit is not performed if the device is suspended or if
      the DM_NOFLUSH_FLAG is supplied by userspace and passed to the target
      through a new 'status_flags' parameter in the target's dm_status_fn.
      
      The userspace dmsetup tool will support the --noflush flag with the
      'dmsetup status' and 'dmsetup wait' commands from version 1.02.76
      onwards.
      Tested-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      1f4e0ff0
    • M
      dm mpath: add retain_attached_hw_handler feature · a58a935d
      Mike Snitzer 提交于
      A SCSI device handler might get attached to a device during the
      initial device scan.  We do not necessarily want to override
      this when loading a multipath table, so this patch adds a new
      multipath feature argument "retain_attached_hw_handler".
      
      During SCSI device scan all loaded SCSI device handlers will be
      consulted for a match (via scsi_dh's provided .match).  If a match is
      found that device handler will be attached.  We need a way to have
      userspace multipathd's provided 'hw_handler' not override the already
      attached hardware handler.
      
      When specifying the new feature 'retain_attached_hw_handler' multipath
      will use the currently attached hardware handler instead of trying to
      attach the one specified during table load.  If no hardware handler is
      attached the specified hardware handler will still be used.
      
      Leverages scsi_dh_attach's ability to increment the scsi_dh's reference
      count if the same scsi_dh name is provided when attaching - currently
      attached scsi_dh name is determined with scsi_dh_attached_handler_name.
      
      Depends upon commit 7e8a74b1
      ("[SCSI] scsi_dh: add scsi_dh_attached_handler_name").
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Tested-by: NBabu Moger <babu.moger@netapp.com>
      Reviewed-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Acked-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      a58a935d
  3. 03 6月, 2012 3 次提交
    • M
      dm mpath: allow ioctls to trigger pg init · 35991652
      Mikulas Patocka 提交于
      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: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      35991652
    • M
      dm mpath: delay retry of bypassed pg · f220fd4e
      Mike Christie 提交于
      If I/O needs retrying and only bypassed priority groups are available,
      set the pg_init_delay_retry flag to wait before retrying.
      
      If, for example, the reason for the bypass is that the controller is
      getting reset or there is a firmware upgrade happening, retrying right
      away would cause a flood of log messages and retries for what could be a
      few seconds or even several minutes.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      f220fd4e
    • M
      dm mpath: reduce size of struct multipath · 1fbdd2b3
      Mike Snitzer 提交于
      Move multipath structure's 'lock' and 'queue_size' members to eliminate
      two 4-byte holes.  Also use a bit within a single unsigned int for each
      existing flag (saves 8-bytes).  This allows future flags to be added
      without each consuming an unsigned int.
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Acked-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      1fbdd2b3
  4. 12 5月, 2012 1 次提交
  5. 29 3月, 2012 2 次提交
  6. 15 1月, 2012 1 次提交
  7. 02 8月, 2011 2 次提交
  8. 27 7月, 2011 1 次提交
  9. 29 5月, 2011 1 次提交
  10. 24 3月, 2011 2 次提交
    • M
      dm mpath: allow table load with no priority groups · a490a07a
      Mike Snitzer 提交于
      This patch adjusts the multipath target to allow a table with both 0
      priority groups and 0 for the initial priority group number.
      
      If any mpath device is held open when all paths in the last priority
      group have failed, userspace multipathd will attempt to reload the
      associated DM table to reflect the fact that the device no longer has
      any priority groups.  But the reload attempt always failed because the
      multipath target did not allow 0 priority groups.
      
      All multipath target messages related to priority group (enable_group,
      disable_group, switch_group) will handle a priority group of 0 (will
      cause error).
      
      When reloading a multipath table with 0 priority groups, userspace
      multipathd must be updated to specify an initial priority group number
      of 0 (rather than 1).
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: Babu Moger <babu.moger@lsi.com>
      Acked-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      a490a07a
    • M
      dm mpath: fail message ioctl if specified path is not valid · 19040c0b
      Mike Snitzer 提交于
      Fail the reinstate_path and fail_path message ioctl if the specified
      path is not valid.
      
      The message ioctl would succeed for the 'reinistate_path' and
      'fail_path' messages even if action was not taken because the
      specified device was not a valid path of the multipath device.
      
      Before, when /dev/vdb is not a path of mpathb:
      $ dmsetup message mpathb 0 reinstate_path /dev/vdb
      $ echo $?
      0
      
      After:
      $ dmsetup message mpathb 0 reinstate_path /dev/vdb
      device-mapper: message ioctl failed: Invalid argument
      Command failed
      $ echo $?
      1
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      19040c0b
  11. 13 2月, 2011 1 次提交
  12. 14 1月, 2011 4 次提交
  13. 12 8月, 2010 2 次提交
  14. 06 3月, 2010 7 次提交
  15. 11 12月, 2009 4 次提交
  16. 05 12月, 2009 1 次提交
  17. 23 8月, 2009 1 次提交
  18. 24 7月, 2009 1 次提交
  19. 22 6月, 2009 3 次提交
    • K
      dm mpath: change to be request based · f40c67f0
      Kiyoshi Ueda 提交于
      This patch converts dm-multipath target to request-based from bio-based.
      
      Basically, the patch just converts the I/O unit from struct bio
      to struct request.
      In the course of the conversion, it also changes the I/O queueing
      mechanism.  The change in the I/O queueing is described in details
      as follows.
      
      I/O queueing mechanism change
      -----------------------------
      In I/O submission, map_io(), there is no mechanism change from
      bio-based, since the clone request is ready for retry as it is.
      However, in I/O complition, do_end_io(), there is a mechanism change
      from bio-based, since the clone request is not ready for retry.
      
      In do_end_io() of bio-based, the clone bio has all needed memory
      for resubmission.  So the target driver can queue it and resubmit
      it later without memory allocations.
      The mechanism has almost no overhead.
      
      On the other hand, in do_end_io() of request-based, the clone request
      doesn't have clone bios, so the target driver can't resubmit it
      as it is.  To resubmit the clone request, memory allocation for
      clone bios is needed, and it takes some overheads.
      To avoid the overheads just for queueing, the target driver doesn't
      queue the clone request inside itself.
      Instead, the target driver asks dm core for queueing and remapping
      the original request of the clone request, since the overhead for
      queueing is just a freeing memory for the clone request.
      
      As a result, the target driver doesn't need to record/restore
      the information of the original request for resubmitting
      the clone request.  So dm_bio_details in dm_mpath_io is removed.
      
      multipath_busy()
      ---------------------
      The target driver returns "busy", only when the following case:
        o The target driver will map I/Os, if map() function is called
        and
        o The mapped I/Os will wait on underlying device's queue due to
          their congestions, if map() function is called now.
      
      In other cases, the target driver doesn't return "busy".
      Otherwise, dm core will keep the I/Os and the target driver can't
      do what it wants.
      (e.g. the target driver can't map I/Os now, so wants to kill I/Os.)
      Signed-off-by: NKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Acked-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      f40c67f0
    • M
      dm target:s introduce iterate devices fn · af4874e0
      Mike Snitzer 提交于
      Add .iterate_devices to 'struct target_type' to allow a function to be
      called for all devices in a DM target.  Implemented it for all targets
      except those in dm-snap.c (origin and snapshot).
      
      (The raid1 version number jumps to 1.12 because we originally reserved
      1.1 to 1.11 for 'block_on_error' but ended up using 'handle_errors'
      instead.)
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      Cc: martin.petersen@oracle.com
      af4874e0
    • K
      dm mpath: add start_io and nr_bytes to path selectors · 02ab823f
      Kiyoshi Ueda 提交于
      This patch makes two additions to the dm path selector interface for
      dynamic load balancers:
        o a new hook, start_io()
        o a new parameter 'nr_bytes' to select_path()/start_io()/end_io()
          to pass the size of the I/O
      
      start_io() is called when a target driver actually submits I/O
      to the selected path.
      Path selectors can use it to start accounting of the I/O.
      (e.g. counting the number of in-flight I/Os.)
      The start_io hook is based on the patch posted by Stefan Bader:
      https://www.redhat.com/archives/dm-devel/2005-October/msg00050.html
      
      nr_bytes, the size of the I/O, is so path selectors can take the
      size of the I/O into account when deciding which path to use.
      dm-service-time uses it to estimate service time, for example.
      (Added the nr_bytes member to dm_mpath_io instead of using existing
       details.bi_size, since request-based dm patch deletes it.)
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      Signed-off-by: NKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      02ab823f