1. 14 Jun, 2016 8 commits
    • Mike Snitzer's avatar
      dm raid: bump to v1.9.0 and make the extended SB feature flag reflect it · 9b6e5423
      Mike Snitzer authored
      No idea what Heinz was doing with the versioning but upstream commit
      4c9971ca
      
       ("dm raid: make sure no feature flags are set in metadata")
      bumped to 1.8.0 already.
      
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      9b6e5423
    • Mike Snitzer's avatar
      dm raid: remove ti_error_* wrappers · bd83a4c4
      Mike Snitzer authored
      
      
      There ti_error_* wrappers added very little.  No other DM target has
      ever gone to such lengths to wrap setting ti->error.
      
      Also fixes some NULL derefences via rs->ti->error.
      
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      bd83a4c4
    • Mike Snitzer's avatar
      dm raid: tabify appropriate whitespace · 43157840
      Mike Snitzer authored
      
      
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      43157840
    • Heinz Mauelshagen's avatar
      dm raid: enhance status interface and fixup takeover/raid0 · 3a1c1ef2
      Heinz Mauelshagen authored
      
      
      The target's status interface has to provide the new 'data_offset' value
      to allow userspace to retrieve the kernels offset to the data on each
      raid device of a raid set.  This is the base for out-of-place reshaping
      required to not write over any data during reshaping (e.g. change
      raid6_zr -> raid6_nc):
      
       - add rs_set_cur() to be able to start up existing array in case of no
         takeover; use in ctr on takeover check
      
       - enhance raid_status()
      
       - add supporting functions to get resync/reshape progress and raid
         device status chars
      
       - fixup rebuild table line output race, which does miss to emit
         'rebuild N' on fully synced/rebuild devices, because it is relying on
         the transient 'In_sync' raid device flag
      
       - add new status line output for 'data_offset', which'll later be used
         for out-of-place reshaping
      
       - fixup takeover not working for all levels
      
       - fixup raid0 message interface oops caused by missing checks
         for the md threads, which don't exist in case of raid0
      
       - remove ALL_FREEZE_FLAGS not needed for takeover
      
       - adjust comments
      
      Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      3a1c1ef2
    • Heinz Mauelshagen's avatar
      dm raid: add raid level takeover support · ecbfb9f1
      Heinz Mauelshagen authored
      
      
      Add raid level takeover support allowing arbitrary takeovers between
      raid levels supported by md personalities (i.e. raid0, raid1/10 and
      raid4/5/6):
      
       - add rs_config_{backup|restore} function to allow for temporary
         storing ctr requested layout changes and restore them for takeover
         conersion decision after the superblocks got loaded and analyzed
      
       - add members to store layout to 'struct raid_set' (not mandatory
         for takeover but needed for reshape in later patch)
      
       - add rebuild_disks bitfield to 'struct raid_set' and set bits in ctr
         to use in setting up takeover (base to address a 'rebuild' related
         raid_status() table line bug and needed as well for reshape in future
         patch)
      
       - add runtime flags and respective manipulation functions to be able to
         control e.g. wrting of superlocks to the preresume function on
         takeover and (later) reshape
      
       - add functions to detect takeover, check it's valid (mandatory here to
         avoid failing on md_run()), setup for it and use in the ctr; those
         will be likely moved out once reshaping gets added to simplify the
         ctr
      
       - start raid set readonly in ctr and switch to readwrite, optionally
         updating superblocks, in preresume in order to allow suspend to
         quiesce any active table before (which involves superblock updates);
         this ensures the proper sequence of writing the current and any new
         takeover(/reshape) metadata
      
      Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      ecbfb9f1
    • Heinz Mauelshagen's avatar
      dm raid: enhance super_sync() to support new superblock members · 7b34df74
      Heinz Mauelshagen authored
      
      
      Add transferring the new takeover/reshape related superblock
      members introduced to the super_sync() function:
      
       - add/move supporting functions
      
       - add failed devices bitfield transfer functions to retrieve the
         bitfield from superblock format or update it in the superblock
      
       - add code to transfer all new members
      
      Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      7b34df74
    • Heinz Mauelshagen's avatar
      dm raid: add new reshaping/raid10 format table line options to parameter parser · 4763e543
      Heinz Mauelshagen authored
      
      
      Support the follwoing arguments in the ctr parameter parser:
      
       - add 'delta_disks', 'data_offset' taking int and sector respectively
      
       - 'raid10_use_near_sets' bool argument to optionally select
         near sets with supporting raid10 mappings
      
      Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      4763e543
    • Heinz Mauelshagen's avatar
      dm raid: introduce extended superblock and new raid types to support takeover/reshaping · 33e53f06
      Heinz Mauelshagen authored
      
      
      Add new members to the dm-raid superblock and new raid types to support
      takeover/reshape.
      
      Add all necessary members needed to support takeover and reshape in one
      go -- aiming to limit the amount of changes to the superblock layout.
      
      This is a larger patch due to the new superblock members, their related
      flags, validation of both and involved API additions/changes:
      
       - add additional members to keep track of:
         - state about forward/backward reshaping
         - reshape position
         - new level, layout, stripe size and delta disks
         - data offset to current and new data for out-of-place reshapes
         - failed devices bitfield extensions to keep track of max raid devices
      
       - adjust super_validate() to cope with new superblock members
      
       - adjust super_init_validation() to cope with new superblock members
      
       - add definitions for ctr flags supporting delta disks etc.
      
       - add new raid types (raid6_n_6 etc.)
      
       - add new raid10 supporting function API (_is_raid10_*())
      
       - adjust to changed raid10 supporting function API
      
      Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      33e53f06
  2. 13 Jun, 2016 6 commits
  3. 07 Jun, 2016 1 commit
  4. 13 May, 2016 1 commit
  5. 02 Oct, 2015 1 commit
    • Mikulas Patocka's avatar
      dm raid: fix round up of default region size · 042745ee
      Mikulas Patocka authored
      Commit 3a0f9aae
      
       ("dm raid: round region_size to power of two")
      intended to make sure that the default region size is a power of two.
      However, the logic in that commit is incorrect and sets the variable
      region_size to 0 or 1, depending on whether min_region_size is a power
      of two.
      
      Fix this logic, using roundup_pow_of_two(), so that region_size is
      properly rounded up to the next power of two.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Fixes: 3a0f9aae
      
       ("dm raid: round region_size to power of two")
      Cc: stable@vger.kernel.org # v3.8+
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      042745ee
  6. 13 Aug, 2015 1 commit
    • Kent Overstreet's avatar
      block: kill merge_bvec_fn() completely · 8ae12666
      Kent Overstreet authored
      
      
      As generic_make_request() is now able to handle arbitrarily sized bios,
      it's no longer necessary for each individual block driver to define its
      own ->merge_bvec_fn() callback. Remove every invocation completely.
      
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
      Cc: drbd-user@lists.linbit.com
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Yehuda Sadeh <yehuda@inktank.com>
      Cc: Sage Weil <sage@inktank.com>
      Cc: Alex Elder <elder@kernel.org>
      Cc: ceph-devel@vger.kernel.org
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      Cc: Neil Brown <neilb@suse.de>
      Cc: linux-raid@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Acked-by: NeilBrown <neilb@suse.de> (for the 'md' bits)
      Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
      [dpark: also remove ->merge_bvec_fn() in dm-thin as well as
       dm-era-target, and resolve merge conflicts]
      Signed-off-by: default avatarDongsu Park <dpark@posteo.net>
      Signed-off-by: default avatarMing Lin <ming.l@ssi.samsung.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      8ae12666
  7. 29 May, 2015 3 commits
  8. 09 Feb, 2015 1 commit
  9. 03 Feb, 2015 1 commit
    • NeilBrown's avatar
      md: make ->congested robust against personality changes. · 5c675f83
      NeilBrown authored
      
      
      There is currently no locking around calls to the 'congested'
      bdi function.  If called at an awkward time while an array is
      being converted from one level (or personality) to another, there
      is a tiny chance of running code in an unreferenced module etc.
      
      So add a 'congested' function to the md_personality operations
      structure, and call it with appropriate locking from a central
      'mddev_congested'.
      
      When the array personality is changing the array will be 'suspended'
      so no IO is processed.
      If mddev_congested detects this, it simply reports that the
      array is congested, which is a safe guess.
      As mddev_suspend calls synchronize_rcu(), mddev_congested can
      avoid races by included the whole call inside an rcu_read_lock()
      region.
      This require that the congested functions for all subordinate devices
      can be run under rcu_lock.  Fortunately this is the case.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      5c675f83
  10. 29 Oct, 2014 1 commit
  11. 21 Oct, 2014 1 commit
  12. 06 Oct, 2014 2 commits
  13. 26 Jun, 2013 1 commit
    • Jonathan Brassow's avatar
      MD: Remember the last sync operation that was performed · c4a39551
      Jonathan Brassow authored
      
      
      MD:  Remember the last sync operation that was performed
      
      This patch adds a field to the mddev structure to track the last
      sync operation that was performed.  This is especially useful when
      it comes to what is recorded in mismatch_cnt in sysfs.  If the
      last operation was "data-check", then it reports the number of
      descrepancies found by the user-initiated check.  If it was a
      "repair" operation, then it is reporting the number of
      descrepancies repaired.  etc.
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      c4a39551
  14. 13 Jun, 2013 5 commits
    • Jingoo Han's avatar
      md: replace strict_strto*() with kstrto*() · b29bebd6
      Jingoo Han authored
      
      
      The usage of strict_strtoul() is not preferred, because
      strict_strtoul() is obsolete. Thus, kstrtoul() should be
      used.
      
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      b29bebd6
    • NeilBrown's avatar
      dm-raid: silence compiler warning on rebuilds_per_group. · 3f6bbd3f
      NeilBrown authored
      
      
      This doesn't really need to be initialised, but it doesn't hurt,
      silences the compiler, and as it is a counter it makes sense for it to
      start at zero.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      3f6bbd3f
    • Jonathan Brassow's avatar
      DM RAID: Fix raid_resume not reviving failed devices in all cases · a4dc163a
      Jonathan Brassow authored
      
      
      DM RAID:  Fix raid_resume not reviving failed devices in all cases
      
      When a device fails in a RAID array, it is marked as Faulty.  Later,
      md_check_recovery is called which (through the call chain) calls
      'hot_remove_disk' in order to have the personalities remove the device
      from use in the array.
      
      Sometimes, it is possible for the array to be suspended before the
      personalities get their chance to perform 'hot_remove_disk'.  This is
      normally not an issue.  If the array is deactivated, then the failed
      device will be noticed when the array is reinstantiated.  If the
      array is resumed and the disk is still missing, md_check_recovery will
      be called upon resume and 'hot_remove_disk' will be called at that
      time.  However, (for dm-raid) if the device has been restored,
      a resume on the array would cause it to attempt to revive the device
      by calling 'hot_add_disk'.  If 'hot_remove_disk' had not been called,
      a situation is then created where the device is thought to concurrently
      be the replacement and the device to be replaced.  Thus, the device
      is first sync'ed with the rest of the array (because it is the replacement
      device) and then marked Faulty and removed from the array (because
      it is also the device being replaced).
      
      The solution is to check and see if the device had properly been removed
      before the array was suspended.  This is done by seeing whether the
      device's 'raid_disk' field is -1 - a condition that implies that
      'md_check_recovery -> remove_and_add_spares (where raid_disk is set to -1)
      -> hot_remove_disk' has been called.  If 'raid_disk' is not -1, then
      'hot_remove_disk' must be called to complete the removal of the previously
      faulty device before it can be revived via 'hot_add_disk'.
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      a4dc163a
    • Jonathan Brassow's avatar
      DM RAID: Break-up untidy function · f381e71b
      Jonathan Brassow authored
      
      
      DM RAID:  Break-up untidy function
      
      Clean-up excessive indentation by moving some code in raid_resume()
      into its own function.
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      f381e71b
    • Jonathan Brassow's avatar
      DM RAID: Add ability to restore transiently failed devices on resume · 9092c02d
      Jonathan Brassow authored
      
      
      DM RAID: Add ability to restore transiently failed devices on resume
      
      This patch adds code to the resume function to check over the devices
      in the RAID array.  If any are found to be marked as failed and their
      superblocks can be read, an attempt is made to reintegrate them into
      the array.  This allows the user to refresh the array with a simple
      suspend and resume of the array - rather than having to load a
      completely new table, allocate and initialize all the structures and
      throw away the old instantiation.
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      9092c02d
  15. 24 Apr, 2013 1 commit
    • Jonathan Brassow's avatar
      DM RAID: Add message/status support for changing sync action · be83651f
      Jonathan Brassow authored
      
      
      DM RAID:  Add message/status support for changing sync action
      
      This patch adds a message interface to dm-raid to allow the user to more
      finely control the sync actions being performed by the MD driver.  This
      gives the user the ability to initiate "check" and "repair" (i.e. scrubbing).
      Two additional fields have been appended to the status output to provide more
      information about the type of sync action occurring and the results of those
      actions, specifically: <sync_action> and <mismatch_cnt>.  These new fields
      will always be populated.  This is essentially the device-mapper way of doing
      what MD controls through the 'sync_action' sysfs file and shows through the
      'mismatch_cnt' sysfs file.
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      be83651f
  16. 01 Mar, 2013 2 commits
    • Alasdair G Kergon's avatar
      dm: rename request variables to bios · 55a62eef
      Alasdair G Kergon authored
      
      
      Use 'bio' in the name of variables and functions that deal with
      bios rather than 'request' to avoid confusion with the normal
      block layer use of 'request'.
      
      No functional changes.
      
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      55a62eef
    • Mikulas Patocka's avatar
      dm: fix truncated status strings · fd7c092e
      Mikulas Patocka authored
      
      
      Avoid returning a truncated table or status string instead of setting
      the DM_BUFFER_FULL_FLAG when the last target of a table fills the
      buffer.
      
      When processing a table or status request, the function retrieve_status
      calls ti->type->status. If ti->type->status returns non-zero,
      retrieve_status assumes that the buffer overflowed and sets
      DM_BUFFER_FULL_FLAG.
      
      However, targets don't return non-zero values from their status method
      on overflow. Most targets returns always zero.
      
      If a buffer overflow happens in a target that is not the last in the
      table, it gets noticed during the next iteration of the loop in
      retrieve_status; but if a buffer overflow happens in the last target, it
      goes unnoticed and erroneously truncated data is returned.
      
      In the current code, the targets behave in the following way:
      * dm-crypt returns -ENOMEM if there is not enough space to store the
        key, but it returns 0 on all other overflows.
      * dm-thin returns errors from the status method if a disk error happened.
        This is incorrect because retrieve_status doesn't check the error
        code, it assumes that all non-zero values mean buffer overflow.
      * all the other targets always return 0.
      
      This patch changes the ti->type->status function to return void (because
      most targets don't use the return code). Overflow is detected in
      retrieve_status: if the status method fills up the remaining space
      completely, it is assumed that buffer overflow happened.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      fd7c092e
  17. 26 Feb, 2013 1 commit
    • Jonathan Brassow's avatar
      DM RAID: Add support for MD's RAID10 "far" and "offset" algorithms · fe5d2f4a
      Jonathan Brassow authored
      
      
      DM RAID:  Add support for MD's RAID10 "far" and "offset" algorithms
      
      Until now, dm-raid.c only supported the "near" algorthm of MD's RAID10
      implementation.  This patch adds support for the "far" and "offset"
      algorithms, but only with the improved redundancy that is brought with
      the introduction of the 'use_far_sets' bit, which shifts copied stripes
      according to smaller sets vs the entire array.  That is, the 17th bit
      of the 'layout' variable that defines the RAID10 implementation will
      always be set.   (More information on how the 'layout' variable selects
      the RAID10 algorithm can be found in the opening comments of
      drivers/md/raid10.c.)
      
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      fe5d2f4a
  18. 24 Jan, 2013 1 commit
    • Jonathan Brassow's avatar
      DM-RAID: Fix RAID10's check for sufficient redundancy · 55ebbb59
      Jonathan Brassow authored
      Before attempting to activate a RAID array, it is checked for sufficient
      redundancy.  That is, we make sure that there are not too many failed
      devices - or devices specified for rebuild - to undermine our ability to
      activate the array.  The current code performs this check twice - once to
      ensure there were not too many devices specified for rebuild by the user
      ('validate_rebuild_devices') and again after possibly experiencing a failure
      to read the superblock ('analyse_superblocks').  Neither of these checks are
      sufficient.  The first check is done properly but with insufficient
      information about the possible failure state of the devices to make a good
      determination if the array can be activated.  The second check is simply
      done wrong in the case of RAID10 because it doesn't account for the
      independence of the stripes (i.e. mirror sets).  The solution is to use the
      properly written check ('validate_rebuild_devices'), but perform the check
      after the superblocks have been read and we know which devices have failed.
      This gives us one check instead of two and performs it in a location where
      it can be done right.
      
      Only RAID10 was affected and it was affected in the following ways:
      - the code did not properly catch the condition where a user specified
        a device for rebuild that already had a failed device in the same mirror
        set.  (This condition would, however, be caught at a deeper level in MD.)
      - the code triggers a false positive and denies activation when devices in
        independent mirror sets have failed - counting the failures as though they
        were all in the same set.
      
      The most likely place this error was introduced (or this patch should have
      been included) is in commit 4ec1e369
      
       - first introduced in v3.7-rc1.
      Consequently this fix should also go in v3.7.y, however there is a
      small conflict on the .version in raid_target, so I'll submit a
      separate patch to -stable.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      55ebbb59
  19. 21 Dec, 2012 2 commits