1. 14 1月, 2009 20 次提交
  2. 10 1月, 2009 9 次提交
  3. 09 1月, 2009 11 次提交
    • 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
    • W
      generic swap(): ext3: remove local swap() macro · be857df1
      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>
      be857df1
    • F
      remove lots of double-semicolons · c19a28e1
      Fernando Carrijo 提交于
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Acked-by: NTheodore Ts'o <tytso@mit.edu>
      Acked-by: NMark Fasheh <mfasheh@suse.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: James Morris <jmorris@namei.org>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      Acked-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c19a28e1
    • R
      romfs: romfs_iget() - unsigned ino >= 0 is always true · f1565962
      roel kluin 提交于
      romfs_strnlen() returns int
      unsigned X >= 0 is always true
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: Nroel kluin <roel.kluin@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f1565962
    • M
      vmcore: remove saved_max_pfn check · 921d58c0
      Magnus Damm 提交于
      Remove the saved_max_pfn check from the /proc/vmcore function
      read_from_oldmem().  No need to verify, we should be able to just trust
      that "elfcorehdr=" is correctly passed to the crash kernel on the kernel
      command line like we do with other parameters.
      
      The read_from_oldmem() function in fs/proc/vmcore.c is quite similar to
      read_from_oldmem() in drivers/char/mem.c, but only in the latter it makes
      sense to use saved_max_pfn.  For oldmem it is used to determine when to
      stop reading.  For vmcore we already have the elf header info pointing out
      the physical memory regions, no need to pass the end-of- old-memory twice.
      
      Removing the saved_max_pfn check from vmcore makes it possible for
      architectures to skip oldmem but still support crash dump through vmcore -
      without the need for the old saved_max_pfn cruft.
      
      Architectures that want to play safe can do the saved_max_pfn check in
      copy_oldmem_page().  Not sure why anyone would want to do that, but that's
      even safer than today - the saved_max_pfn check in vmcore removed by this
      patch only checks the first page.
      Signed-off-by: NMagnus Damm <damm@igel.co.jp>
      Acked-by: NVivek Goyal <vgoyal@redhat.com>
      Acked-by: NSimon Horman <horms@verge.net.au>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      921d58c0
    • K
      ELF: implement AT_RANDOM for glibc PRNG seeding · f06295b4
      Kees Cook 提交于
      While discussing[1] the need for glibc to have access to random bytes
      during program load, it seems that an earlier attempt to implement
      AT_RANDOM got stalled.  This implements a random 16 byte string, available
      to every ELF program via a new auxv AT_RANDOM vector.
      
      [1] http://sourceware.org/ml/libc-alpha/2008-10/msg00006.html
      
      Ulrich said:
      
      glibc needs right after startup a bit of random data for internal
      protections (stack canary etc).  What is now in upstream glibc is that we
      always unconditionally open /dev/urandom, read some data, and use it.  For
      every process startup.  That's slow.
      
      ...
      
      The solution is to provide a limited amount of random data to the
      starting process in the aux vector.  I suggested 16 bytes and this is
      what the patch implements.  If we need only 16 bytes or less we use the
      data directly.  If we need more we'll use the 16 bytes to see a PRNG.
      This avoids the costly /dev/urandom use and it allows the kernel to use
      the most adequate source of random data for this purpose.  It might not
      be the same pool as that for /dev/urandom.
      
      Concerns were expressed about the depletion of the randomness pool.  But
      this patch doesn't make the situation worse, it doesn't deplete entropy
      more than happens now.
      Signed-off-by: NKees Cook <kees.cook@canonical.com>
      Cc: Jakub Jelinek <jakub@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f06295b4