1. 03 Apr, 2009 6 commits
    • Jeff Layton's avatar
      writeback: guard against jiffies wraparound on inode->dirtied_when checks (try #3) · d2caa3c5
      Jeff Layton authored
      The dirtied_when value on an inode is supposed to represent the first time
      that an inode has one of its pages dirtied.  This value is in units of
      jiffies.  It's used in several places in the writeback code to determine
      when to write out an inode.
      
      The problem is that these checks assume that dirtied_when is updated
      periodically.  If an inode is continuously being used for I/O it can be
      persistently marked as dirty and will continue to age.  Once the time
      compared to is greater than or equal to half the maximum of the jiffies
      type, the logic of the time_*() macros inverts and the opposite of what is
      needed is returned.  On 32-bit architectures that's just under 25 days
      (assuming HZ == 1000).
      
      As the least-recently dirtied inode, it'll end up being the first one that
      pdflush will try to write out.  sync_sb_inodes does this check:
      
      	/* Was this inode dirtied after sync_sb_inodes was called? */
       	if (time_after(inode->dirtied_when, start))
       		break;
      
      ...but now dirtied_when appears to be in the future.  sync_sb_inodes bails
      out without attempting to write any dirty inodes.  When this occurs,
      pdflush will stop writing out inodes for this superblock.  Nothing can
      unwedge it until jiffies moves out of the problematic window.
      
      This patch fixes this problem by changing the checks against dirtied_when
      to also check whether it appears to be in the future.  If it does, then we
      consider the value to be far in the past.
      
      This should shrink the problematic window of time to such a small period
      (30s) as not to matter.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
      Acked-by: default avatarIan Kent <raven@themaw.net>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d2caa3c5
    • Andrew Morton's avatar
      __tty_open(): use the correct type for saved_flags · 846c151a
      Andrew Morton authored
      filp->f_flags is unsigned, so use that type for the local copy.
      
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      846c151a
    • Wu Fengguang's avatar
      vfs: skip I_CLEAR state inodes · b6fac63c
      Wu Fengguang authored
      clear_inode() will switch inode state from I_FREEING to I_CLEAR, and do so
      _outside_ of inode_lock.  So any I_FREEING testing is incomplete without a
      coupled testing of I_CLEAR.
      
      So add I_CLEAR tests to drop_pagecache_sb(), generic_sync_sb_inodes() and
      add_dquot_ref().
      
      Masayoshi MIZUMA discovered the bug in drop_pagecache_sb() and Jan Kara
      reminds fixing the other two cases.
      
      Masayoshi MIZUMA has a nice panic flow:
      
      =====================================================================
                  [process A]               |        [process B]
       |                                    |
       |    prune_icache()                  | drop_pagecache()
       |      spin_lock(&inode_lock)        |   drop_pagecache_sb()
       |      inode->i_state |= I_FREEING;  |       |
       |      spin_unlock(&inode_lock)      |       V
       |          |                         |     spin_lock(&inode_lock)
       |          V                         |         |
       |      dispose_list()                |         |
       |        list_del()                  |         |
       |        clear_inode()               |         |
       |          inode->i_state = I_CLEAR  |         |
       |            |                       |         V
       |            |                       |      if (inode->i_state & (I_FREEING|I_WILL_FREE))
       |            |                       |              continue;           <==== NOT MATCH
       |            |                       |
       |            |                       | (DANGER from here on! Accessing disposing inode!)
       |            |                       |
       |            |                       |      __iget()
       |            |                       |        list_move() <===== PANIC on poisoned list !!
       V            V                       |
      (time)
      =====================================================================
      Reported-by: default avatarMasayoshi MIZUMA <m.mizuma@jp.fujitsu.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b6fac63c
    • David Howells's avatar
      nommu: fix a number of issues with the per-MM VMA patch · 33e5d769
      David Howells authored
      Fix a number of issues with the per-MM VMA patch:
      
       (1) Make mmap_pages_allocated an atomic_long_t, just in case this is used on
           a NOMMU system with more than 2G pages.  Makes no difference on a 32-bit
           system.
      
       (2) Report vma->vm_pgoff * PAGE_SIZE as a 64-bit value, not a 32-bit value,
           lest it overflow.
      
       (3) Move the allocation of the vm_area_struct slab back for fork.c.
      
       (4) Use KMEM_CACHE() for both vm_area_struct and vm_region slabs.
      
       (5) Use BUG_ON() rather than if () BUG().
      
       (6) Make the default validate_nommu_regions() a static inline rather than a
           #define.
      
       (7) Make free_page_series()'s objection to pages with a refcount != 1 more
           informative.
      
       (8) Adjust the __put_nommu_region() banner comment to indicate that the
           semaphore must be held for writing.
      
       (9) Limit the number of warnings about munmaps of non-mmapped regions.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Greg Ungerer <gerg@snapgear.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      33e5d769
    • Sergey Senozhatsky's avatar
      fb: nvidiafb recognizes geforcego 7300 chip as mobile · 5482415a
      Sergey Senozhatsky authored
      nvidiafb recognizes geforcego 7300 chip as mobile
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@mail.by>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5482415a
    • Akinobu Mita's avatar
      generic debug pagealloc: build fix · ee3b4290
      Akinobu Mita authored
      This fixes a build failure with generic debug pagealloc:
      
        mm/debug-pagealloc.c: In function 'set_page_poison':
        mm/debug-pagealloc.c:8: error: 'struct page' has no member named 'debug_flags'
        mm/debug-pagealloc.c: In function 'clear_page_poison':
        mm/debug-pagealloc.c:13: error: 'struct page' has no member named 'debug_flags'
        mm/debug-pagealloc.c: In function 'page_poison':
        mm/debug-pagealloc.c:18: error: 'struct page' has no member named 'debug_flags'
        mm/debug-pagealloc.c: At top level:
        mm/debug-pagealloc.c:120: error: redefinition of 'kernel_map_pages'
        include/linux/mm.h:1278: error: previous definition of 'kernel_map_pages' was here
        mm/debug-pagealloc.c: In function 'kernel_map_pages':
        mm/debug-pagealloc.c:122: error: 'debug_pagealloc_enabled' undeclared (first use in this function)
      
      by fixing
      
       - debug_flags should be in struct page
       - define DEBUG_PAGEALLOC config option for all architectures
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reported-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ee3b4290
  2. 01 Apr, 2009 34 commits