1. 19 3月, 2012 16 次提交
    • N
      md: fix clearing of the 'changed' flags for the bad blocks list. · d0962936
      NeilBrown 提交于
      In super_1_sync (the first hunk) we need to clear 'changed' before
      checking read_seqretry(), otherwise we might race with other code
      adding a bad block and so won't retry later.
      
      In md_update_sb (the second hunk), in the case where there is no
      metadata (neither persistent nor external), we treat any bad blocks as
      an error.  However we need to clear the 'changed' flag before calling
      md_ack_all_badblocks, else it won't do anything.
      
      This patch is suitable for -stable release 3.0 and later.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d0962936
    • N
      md/bitmap: discard CHUNK_BLOCK_SHIFT macro · 61a0d80c
      NeilBrown 提交于
      Be redefining ->chunkshift as the shift from sectors to chunks rather
      than bytes to chunks, we can just use "bitmap->chunkshift" which is
      shorter than the macro call, and less indirect.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      61a0d80c
    • N
      md/bitmap: remove unnecessary indirection when allocating. · 792a1d4b
      NeilBrown 提交于
      These funcitons don't add anything useful except possibly the trace
      points, and I don't think they are worth the extra indirection.
      So remove them.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      792a1d4b
    • N
      md/bitmap: remove some pointless locking. · 5a6c824e
      NeilBrown 提交于
      There is nothing gained by holding a lock while we check if a pointer
      is NULL or not.  If there could be a race, then it could become NULL
      immediately after the unlock - but there is no race here.
      
      So just remove the locking.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      5a6c824e
    • N
      md/bitmap: change a 'goto' to a normal 'if' construct. · 278c1ca2
      NeilBrown 提交于
      The use of a goto makes the control flow more obscure here.
      
      So make it a normal:
        if (x) {
           Y;
        }
      
      No functional change.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      278c1ca2
    • N
      md/bitmap: move printing of bitmap status to bitmap.c · 57148964
      NeilBrown 提交于
      The part of /proc/mdstat which describes the bitmap should really
      be generated by code in bitmap.c.  So move it there.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      57148964
    • N
      md/bitmap: remove some unused noise from bitmap.h · 4ba97dff
      NeilBrown 提交于
      Signed-off-by: NNeilBrown <neilb@suse.de>
      4ba97dff
    • N
      md/raid10 - support resizing some RAID10 arrays. · 006a09a0
      NeilBrown 提交于
      'resizing' an array in this context means making use of extra
      space that has become available in component devices, not adding new
      devices.
      It also includes shrinking the array to take up less space of
      component devices.
      
      This is not supported for array with a 'far' layout.  However
      for 'near' and 'offset' layout arrays, adding and removing space at
      the end of the devices is easy to support, and this patch provides
      that support.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      006a09a0
    • N
      md/raid1: handle merge_bvec_fn in member devices. · 6b740b8d
      NeilBrown 提交于
      Currently we don't honour merge_bvec_fn in member devices so if there
      is one, we force all requests to be single-page at most.
      This is not ideal.
      
      So create a raid1 merge_bvec_fn to check that function in children
      as well.
      
      This introduces a small problem.  There is no locking around calls
      the ->merge_bvec_fn and subsequent calls to ->make_request.  So a
      device added between these could end up getting a request which
      violates its merge_bvec_fn.
      
      Currently the best we can do is synchronize_sched().  This will work
      providing no preemption happens.  If there is is preemption, we just
      have to hope that new devices are largely consistent with old devices.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      6b740b8d
    • N
      md/raid10: handle merge_bvec_fn in member devices. · 050b6615
      NeilBrown 提交于
      Currently we don't honour merge_bvec_fn in member devices so if there
      is one, we force all requests to be single-page at most.
      This is not ideal.
      
      So enhance the raid10 merge_bvec_fn to check that function in children
      as well.
      
      This introduces a small problem.  There is no locking around calls
      the ->merge_bvec_fn and subsequent calls to ->make_request.  So a
      device added between these could end up getting a request which
      violates its merge_bvec_fn.
      
      Currently the best we can do is synchronize_sched().  This will work
      providing no preemption happens.  If there is preemption, we just
      have to hope that new devices are largely consistent with old devices.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      050b6615
    • N
      md: add proper merge_bvec handling to RAID0 and Linear. · ba13da47
      NeilBrown 提交于
      These personalities currently set a max request size of one page
      when any member device has a merge_bvec_fn because they don't
      bother to call that function.
      
      This causes extra works in splitting and combining requests.
      
      So make the extra effort to call the merge_bvec_fn when it exists
      so that we end up with larger requests out the bottom.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      ba13da47
    • N
      md: tidy up rdev_for_each usage. · dafb20fa
      NeilBrown 提交于
      md.h has an 'rdev_for_each()' macro for iterating the rdevs in an
      mddev.  However it uses the 'safe' version of list_for_each_entry,
      and so requires the extra variable, but doesn't include 'safe' in the
      name, which is useful documentation.
      
      Consequently some places use this safe version without needing it, and
      many use an explicity list_for_each entry.
      
      So:
       - rename rdev_for_each to rdev_for_each_safe
       - create a new rdev_for_each which uses the plain
         list_for_each_entry,
       - use the 'safe' version only where needed, and convert all other
         list_for_each_entry calls to use rdev_for_each.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      dafb20fa
    • N
      md/raid1,raid10: avoid deadlock during resync/recovery. · d6b42dcb
      NeilBrown 提交于
      If RAID1 or RAID10 is used under LVM or some other stacking
      block device, it is possible to enter a deadlock during
      resync or recovery.
      This can happen if the upper level block device creates
      two requests to the RAID1 or RAID10.  The first request gets
      processed, blocks recovery and queue requests for underlying
      requests in current->bio_list.  A resync request then starts
      which will wait for those requests and block new IO.
      
      But then the second request to the RAID1/10 will be attempted
      and it cannot progress until the resync request completes,
      which cannot progress until the underlying device requests complete,
      which are on a queue behind that second request.
      
      So allow that second request to proceed even though there is
      a resync request about to start.
      
      This is suitable for any -stable kernel.
      
      Cc: stable@vger.kernel.org
      Reported-by: NRay Morris <support@bettercgi.com>
      Tested-by: NRay Morris <support@bettercgi.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d6b42dcb
    • N
      md/bitmap: ensure to load bitmap when creating via sysfs. · 4474ca42
      NeilBrown 提交于
      When commit 69e51b44 (md/bitmap:  separate out loading a bitmap...)
      created bitmap_load, it missed calling it after bitmap_create when a
      bitmap is created through the sysfs interface.
      So if a bitmap is added this way, we don't allocate memory properly
      and can crash.
      
      This is suitable for any -stable release since 2.6.35.
      Cc: stable@vger.kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      4474ca42
    • N
      md: don't set md arrays to readonly on shutdown. · c744a65c
      NeilBrown 提交于
      It seems that with recent kernel, writeback can still be happening
      while shutdown is happening, and consequently data can be written
      after the md reboot notifier switches all arrays to read-only.
      This causes a BUG.
      
      So don't switch them to read-only - just mark them clean and
      set 'safemode' to '2' which mean that immediately after any
      write the array will be switch back to 'clean'.
      
      This could result in the shutdown happening when array is marked
      dirty, thus forcing a resync on reboot.  However if you reboot
      without performing a "sync" first, you get to keep both halves.
      
      This is suitable for any stable kernel (though there might be some
      conflicts with obvious fixes in earlier kernels).
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      c744a65c
    • N
      md: allow re-add to failed arrays. · dc10c643
      NeilBrown 提交于
      When an array is failed (some data inaccessible) then there is no
      point attempting to add a spare as it could not possibly be recovered.
      
      However that may be value in re-adding a recently removed device.
      e.g. if there is a write-intent-bitmap and it is clear, then access
      to the data could be restored by this action.
      
      So don't reject a re-add to a failed array for RAID10 and RAID5 (the
      only arrays  types that check for a failed array).
      Signed-off-by: NNeilBrown <neilb@suse.de>
      dc10c643
  2. 13 3月, 2012 5 次提交
  3. 11 3月, 2012 1 次提交
  4. 10 3月, 2012 7 次提交
  5. 09 3月, 2012 11 次提交