1. 14 1月, 2009 25 次提交
  2. 10 1月, 2009 9 次提交
  3. 09 1月, 2009 6 次提交
    • N
      md: make devices disappear when they are no longer needed. · d3374825
      NeilBrown 提交于
      Currently md devices, once created, never disappear until the module
      is unloaded.  This is essentially because the gendisk holds a
      reference to the mddev, and the mddev holds a reference to the
      gendisk, this a circular reference.
      
      If we drop the reference from mddev to gendisk, then we need to ensure
      that the mddev is destroyed when the gendisk is destroyed.  However it
      is not possible to hook into the gendisk destruction process to enable
      this.
      
      So we drop the reference from the gendisk to the mddev and destroy the
      gendisk when the mddev gets destroyed.  However this has a
      complication.
      Between the call
         __blkdev_get->get_gendisk->kobj_lookup->md_probe
      and the call
         __blkdev_get->md_open
      
      there is no obvious way to hold a reference on the mddev any more, so
      unless something is done, it will disappear and gendisk will be
      destroyed prematurely.
      
      Also, once we decide to destroy the mddev, there will be an unlockable
      moment before the gendisk is unlinked (blk_unregister_region) during
      which a new reference to the gendisk can be created.  We need to
      ensure that this reference can not be used.  i.e. the ->open must
      fail.
      
      So:
       1/  in md_probe we set a flag in the mddev (hold_active) which
           indicates that the array should be treated as active, even
           though there are no references, and no appearance of activity.
           This is cleared by md_release when the device is closed if it
           is no longer needed.
           This ensures that the gendisk will survive between md_probe and
           md_open.
      
       2/  In md_open we check if the mddev we expect to open matches
           the gendisk that we did open.
           If there is a mismatch we return -ERESTARTSYS and modify
           __blkdev_get to retry from the top in that case.
           In the -ERESTARTSYS sys case we make sure to wait until
           the old gendisk (that we succeeded in opening) is really gone so
           we loop at most once.
      
      Some udev configurations will always open an md device when it first
      appears.   If we allow an md device that was just created by an open
      to disappear on an immediate close, then this can race with such udev
      configurations and result in an infinite loop the device being opened
      and closed, then re-open due to the 'ADD' even from the first open,
      and then close and so on.
      So we make sure an md device, once created by an open, remains active
      at least until some md 'ioctl' has been made on it.  This means that
      all normal usage of md devices will allow them to disappear promptly
      when not needed, but the worst that an incorrect usage will do it
      cause an inactive md device to be left in existence (it can easily be
      removed).
      
      As an array can be stopped by writing to a sysfs attribute
        echo clear > /sys/block/mdXXX/md/array_state
      we need to use scheduled work for deleting the gendisk and other
      kobjects.  This allows us to wait for any pending gendisk deletion to
      complete by simply calling flush_scheduled_work().
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d3374825
    • D
      dlm: change rsbtbl rwlock to spinlock · c7be761a
      David Teigland 提交于
      The rwlock is almost always used in write mode, so there's no reason
      to not use a spinlock instead.
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      c7be761a
    • D
      dlm: fix seq_file usage in debugfs lock dump · 892c4467
      David Teigland 提交于
      The old code would leak iterators and leave reference counts on
      rsbs because it was ignoring the "stop" seq callback.  The code
      followed an example that used the seq operations differently.
      This new code is based on actually understanding how the seq
      operations work.  It also improves things by saving the hash bucket
      in the position to avoid cycling through completed buckets in start.
      Siged-off-by: NDavd Teigland <teigland@redhat.com>
      892c4467
    • C
      fix similar typos to successfull · 73ac36ea
      Coly Li 提交于
      When I review ocfs2 code, find there are 2 typos to "successfull".  After
      doing grep "successfull " in kernel tree, 22 typos found totally -- great
      minds always think alike :)
      
      This patch fixes all the similar typos. Thanks for Randy's ack and comments.
      Signed-off-by: NColy Li <coyli@suse.de>
      Acked-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Acked-by: NRoland Dreier <rolandd@cisco.com>
      Cc: Jeremy Kerr <jk@ozlabs.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
      Cc: Sridhar Samudrala <sri@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      73ac36ea
    • W
      generic swap(): dcache: use swap() instead of private do_switch() · 9a8d5bb4
      Wu Fengguang 提交于
      Use the new generic implementation.
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9a8d5bb4
    • W
      generic swap(): ext4: remove local swap() macro · 97e133b4
      Wu Fengguang 提交于
      Use the new generic implementation.
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      97e133b4