15 Jan, 2012

1 commit


02 Aug, 2011

2 commits


27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

29 May, 2011

1 commit


24 Mar, 2011

2 commits

  • 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: Mike Snitzer
    Cc: Babu Moger
    Acked-by: Hannes Reinecke
    Signed-off-by: Alasdair G Kergon

    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: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     

13 Feb, 2011

1 commit

  • DM now has more information about the nature of the underlying storage
    failure. Path failure is avoided if a request failed due to a target
    error. Instead the target error is immediately passed up the stack.

    Discard requests that fail due to non-target errors may now be retried.

    Errors restricted to the path will be retried or returned if no
    paths are available, irregarding the no_path_retry setting.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Hannes Reinecke
    Acked-by: Alasdair G Kergon
    Signed-off-by: James Bottomley

    Hannes Reinecke
     

14 Jan, 2011

4 commits

  • This patch adds a user-configurable 'pg_init_delay_msecs' feature. Use
    this feature to specify the number of milliseconds to delay before
    retrying scsi_dh_activate, when SCSI_DH_RETRY is returned.

    SCSI Device Handlers return SCSI_DH_IMM_RETRY if we could retry
    activation immediately and SCSI_DH_RETRY in cases where it is better to
    retry after some delay.

    Currently we immediately retry scsi_dh_activate irrespective of
    SCSI_DH_IMM_RETRY and SCSI_DH_RETRY.

    The 'pg_init_delay_msecs' feature may be provided during table create or
    load, e.g.:
    dmsetup create --table "0 20971520 multipath 3 queue_if_no_path \
    pg_init_delay_msecs 2500 ..." mpatha

    The default for 'pg_init_delay_msecs' is 2000 milliseconds.
    Maximum configurable delay is 60000 milliseconds. Specifying a
    'pg_init_delay_msecs' of 0 will cause immediate retry.

    Signed-off-by: Nikanth Karthikesan
    Signed-off-by: Chandra Seetharaman
    Acked-by: Mike Christie
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Chandra Seetharaman
     
  • Convert all create[_singlethread]_work() users to the new
    alloc[_ordered]_workqueue(). This conversion is mechanical and
    doesn't introduce any behavior change.

    Signed-off-by: Tejun Heo
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Tejun Heo
     
  • flush_scheduled_work() is being deprecated. Flush the used work
    directly instead. In all dm targets, the only work which uses
    system_wq is ->trigger_event.

    Signed-off-by: Tejun Heo
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Tejun Heo
     
  • Revert commit 224cb3e981f1b2f9f93dbd49eaef505d17d894c2
    dm: Call blk_abort_queue on failed paths

    Multipath began to use blk_abort_queue() to allow for
    lower latency path deactivation. This was found to
    cause list corruption:

    the cmd gets blk_abort_queued/timedout run on it and the scsi eh
    somehow is able to complete and run scsi_queue_insert while
    scsi_request_fn is still trying to process the request.

    https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Cc: Mike Anderson
    Cc: Mike Christie
    Cc: stable@kernel.org

    Mike Snitzer
     

12 Aug, 2010

2 commits

  • Enable discard support in the DM multipath target.

    This discard support depends on a few discard-specific fixes to the
    block layer's request stacking driver methods.

    Discard requests are optional so don't allow a failed discard to trigger
    path failures. If there is a real problem with a given path the
    barriers associated with the discard (either before or after the
    discard) will cause path failure. That said, unconditionally passing
    discard failures up the stack is not ideal. This must be fixed once DM
    has more information about the nature of the underlying storage failure.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Cc: Kiyoshi Ueda

    Mike Snitzer
     
  • multipath_ctr() forgets to return an error after detecting
    missing path parameters. Fix this.

    Signed-off-by: Patrick LoPresti
    Cc: stable@kernel.org
    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     

06 Mar, 2010

7 commits

  • Remove unused parameters(start and len) of dm_get_device()
    and fix the callers.

    Signed-off-by: Nikanth Karthikesan
    Signed-off-by: Alasdair G Kergon

    Nikanth Karthikesan
     
  • This patch pulls the pg_init path activation code out of
    process_queued_ios() into a new function.

    No functional change.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • When suspending the device we must wait for all I/O to complete, but
    pg-init may be still in progress even after flushing the workqueue
    for kmpath_handlerd in multipath_postsuspend.

    This patch waits for pg-init completion correctly in
    multipath_postsuspend().

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • m->queue_io is set to block processing I/Os, and it needs to be kept
    while pg-init, which issues multiple path activations, is in progress.
    But m->queue is cleared when a path activation completes without error
    in pg_init_done(), even while other path activations are in progress.
    That may cause undesired -EIO on paths which are not complete activation.

    This patch fixes that by not clearing m->queue_io until all path
    activations complete.

    (Before the hardware handlers were moved into the SCSI layer, pg_init
    only used one path.)

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • 'suspended' flag in struct multipath was introduced to check whether
    the multipath target is in suspended state, but the same check is
    done through dm_suspended() now, so remove the flag and related code.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Cc: Mike Anderson
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • This patch adds two minor fixes while processing device mapper path activation.

    Skip failed paths while calling activate_path. If the path is already failed
    then activate_path will fail for sure. We don't have to call in that case. In
    some case this might cause prolonged retries unnecessarily.

    Change the misleading message if the path being activated fails with SCSI_DH_NOSYS.

    Signed-off-by: Babu Moger
    Signed-off-by: Alasdair G Kergon

    Moger, Babu
     
  • This patch removes some unnecessary argument casting. There is no
    functional change with this patch.

    Passes 'struct pgpath' through to pg_init_done() instead of the enclosed
    'struct dm_path'.

    Tested the changes with LSI storage..

    CC: Chandra Seetharaman
    Signed-off-by: Babu Moger
    Acked-by: Kiyoshi Ueda
    Signed-off-by: Alasdair G Kergon

    Moger, Babu
     

11 Dec, 2009

4 commits


05 Dec, 2009

1 commit


23 Aug, 2009

1 commit


24 Jul, 2009

1 commit

  • Incorrect device area lengths are being passed to device_area_is_valid().

    The regression appeared in 2.6.31-rc1 through commit
    754c5fc7ebb417b23601a6222a6005cc2e7f2913.

    With the dm-stripe target, the size of the target (ti->len) was used
    instead of the stripe_width (ti->len/#stripes). An example of a
    consequent incorrect error message is:

    device-mapper: table: 254:0: sdb too small for target

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     

22 Jun, 2009

9 commits

  • 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: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Acked-by: Hannes Reinecke
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • 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: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Cc: martin.petersen@oracle.com

    Mike Snitzer
     
  • 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: Stefan Bader
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • Flush support for dm-multipath target.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • The commit fe9cf30eb8186ef267d1868dc9f12f2d0f40835a moves dm table event
    submission from kmultipath queue to kernel kevent queue to avoid a
    deadlock.

    There is a possibility of race condition because kevent queue is not flushed
    in the multipath destructor. The scenario is:
    - some event happens and is queued to keventd
    - keventd thread is delayed due to scheuling latency or some other work
    - multipath device is destroyed
    - keventd now attempts to process work_struct that is residing in already
    released memory.

    The patch flushes the keventd queue in multipath constructor.
    I've already fixed similar bug in dm-raid1.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon
    Cc: stable@kernel.org

    Mikulas Patocka
     
  • Fixed a problem affecting reinstatement of passive paths.

    Before we moved the hardware handler from dm to SCSI, it performed a pg_init
    for a path group and didn't maintain any state about each path in hardware
    handler code.

    But in SCSI dh, such state is now maintained, as we want to fail I/O early on a
    path if it is not the active path.

    All the hardware handlers have a state now and set to active or some form of
    inactive. They have prep_fn() which uses this state to fail the I/O without
    it ever being sent to the device.

    So in effect when dm-multipath calls scsi_dh_activate(), activate is
    sent to only one path and the "state" of that path is changed appropriately
    to "active" while other paths in the same path group are never changed
    as they never got an "activate".

    In order make sure all the paths in a path group gets their state set
    properly when a pg_init happens, we need to call scsi_dh_activate() on
    all paths in a path group.

    Doing this at the hardware handler layer is not a good option as we
    want the multipath layer to define the relationship between path and path
    groups and not the hardware handler.

    Attached patch sends an "activate" on each path in a path group when a
    path group is switched. It also sends an activate when a path is reinstated.

    Signed-off-by: Chandra Seetharaman
    Signed-off-by: Alasdair G Kergon

    Chandra Seetharaman
     
  • When specifying a different hardware handler via multipath
    features we should be able to override the built-in defaults.

    The problem here is the hardware table from scsi_dh is compiled
    in and cannot be changed from userland. The multipath.conf OTOH
    is purely user-defined and, what's more, the user might have a valid
    reason for modifying it.
    (EG EMC Clariion can well be run in PNR mode even though ALUA is
    active, or the user might want to try ALUA on any as-of-yet unknown
    devices)

    So _not_ allowing multipath to override the device handler setting
    will just add to the confusion and makes error tracking even more
    difficult.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Alasdair G Kergon

    Hannes Reinecke
     
  • Fix arg count parsing error in hw handlers.

    Cc: stable@kernel.org
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • The parser reads the argument count as a number but doesn't check that
    sufficient arguments are supplied. This command triggers the bug:

    dmsetup create mpath --table "0 `blockdev --getsize /dev/mapper/cr0`
    multipath 0 0 2 1 round-robin 1000 0 1 1 /dev/mapper/cr0
    round-robin 0 1 1 /dev/mapper/cr1 1000"
    kernel BUG at drivers/md/dm-mpath.c:530!

    Cc: stable@kernel.org
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

15 Apr, 2009

1 commit


06 Jan, 2009

2 commits

  • The same workqueue is used both for sending uevents and processing queued I/O.
    Deadlock has been reported in RHEL5 when sending a uevent was blocked waiting
    for the queued I/O to be processed. Use scheduled_work() for the asynchronous
    uevents instead.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Change dm_unregister_target to return void and use BUG() for error
    reporting.

    dm_unregister_target can only fail because of programming bug in the
    target driver. It can't fail because of user's behavior or disk errors.

    This patch changes unregister_target to return void and use BUG if
    someone tries to unregister non-registered target or unregister target
    that is in use.

    This patch removes code duplication (testing of error codes in all dm
    targets) and reports bugs in just one place, in dm_unregister_target. In
    some target drivers, these return codes were ignored, which could lead
    to a situation where bugs could be missed.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka