1. 28 10月, 2010 8 次提交
    • N
      md: change type of first arg to sync_page_io. · 2b193363
      NeilBrown 提交于
      Currently sync_page_io takes a 'bdev'.
      Every caller passes 'rdev->bdev'.
      We will soon want another field out of the rdev in sync_page_io,
      So just pass the rdev instead of the bdev out of it.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      2b193363
    • N
      md/raid1: perform mem allocation before disabling writes during resync. · 1c4588e9
      NeilBrown 提交于
      Though this mem alloc is GFP_NOIO an so will not deadlock, it seems
      better to do the allocation before 'raise_barrier' which stops any IO
      requests while the resync proceeds.
      
      raid10 always uses this order, so it is at least consistent to do the
      same in raid1.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      1c4588e9
    • N
      md: use bio_kmalloc rather than bio_alloc when failure is acceptable. · 6746557f
      NeilBrown 提交于
      bio_alloc can never fail (as it uses a mempool) but an block
      indefinitely, especially if the caller is holding a reference to a
      previously allocated bio.
      
      So these to places which both handle failure and hold multiple bios
      should not use bio_alloc, they should use bio_kmalloc.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      6746557f
    • N
      md: Fix possible deadlock with multiple mempool allocations. · 4e78064f
      NeilBrown 提交于
      It is not safe to allocate from a mempool while holding an item
      previously allocated from that mempool as that can deadlock when the
      mempool is close to exhaustion.
      
      So don't use a bio list to collect the bios to write to multiple
      devices in raid1 and raid10.
      Instead queue each bio as it becomes available so an unplug will
      activate all previously allocated bios and so a new bio has a chance
      of being allocated.
      
      This means we must set the 'remaining' count to '1' before submitting
      any requests, then when all are submitted, decrement 'remaining' and
      possible handle the write completion at that point.
      Reported-by: NTorsten Kaiser <just.for.lkml@googlemail.com>
      Tested-by: NTorsten Kaiser <just.for.lkml@googlemail.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      4e78064f
    • T
      md: fix and update workqueue usage · e804ac78
      Tejun Heo 提交于
      Workqueue usage in md has two problems.
      
      * Flush can be used during or depended upon by memory reclaim, but md
        uses the system workqueue for flush_work which may lead to deadlock.
      
      * md depends on flush_scheduled_work() to achieve exclusion against
        completion of removal of previous instances.  flush_scheduled_work()
        may incur unexpected amount of delay and is scheduled to be removed.
      
      This patch adds two workqueues to md - md_wq and md_misc_wq.  The
      former is guaranteed to make forward progress under memory pressure
      and serves flush_work.  The latter serves as the flush domain for
      other works.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      e804ac78
    • N
      md: use sector_t in bitmap_get_counter · 57dab0bd
      NeilBrown 提交于
      bitmap_get_counter returns the number of sectors covered
      by the counter in a pass-by-reference variable.
      In some cases this can be very large, so make it a sector_t
      for safety.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      57dab0bd
    • N
      md: remove md_mutex locking. · 4b532c9b
      NeilBrown 提交于
      lock_kernel calls were recently pushed down into open/release
      functions.
      md doesn't need that protection.
      Then the BKL calls were change to md_mutex.  We don't need those
      either.
      So remove it all.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      4b532c9b
    • N
      md: Fix regression with raid1 arrays without persistent metadata. · d97a41dc
      NeilBrown 提交于
      A RAID1 which has no persistent metadata, whether internal or
      external, will hang on the first write.
      This is caused by commit  070dc6dd
      In that case, MD_CHANGE_PENDING never gets cleared.
      
      So during md_update_sb, is neither persistent or external,
      clear MD_CHANGE_PENDING.
      
      This is suitable for 2.6.36-stable.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Cc: stable@kernel.org
      d97a41dc
  2. 27 10月, 2010 32 次提交