1. 29 Dec, 2006 1 commit
    • Linus Torvalds's avatar
      VM: Fix nasty and subtle race in shared mmap'ed page writeback · 7658cc28
      Linus Torvalds authored
      The VM layer (on the face of it, fairly reasonably) expected that when
      it does a ->writepage() call to the filesystem, it would write out the
      full page at that point in time.  Especially since it had earlier marked
      the whole page dirty with "set_page_dirty()".
      
      But that isn't actually the case: ->writepage() does not actually write
      a page, it writes the parts of the page that have been explicitly marked
      dirty before, *and* that had not got written out for other reasons since
      the last time we told it they were dirty.
      
      That last caveat is the important one.
      
      Which _most_ of the time ends up being the whole page (since we had
      called "set_page_dirty()" on the page earlier), but if the filesystem
      had done any dirty flushing of its own (for example, to honor some
      internal write ordering guarantees), it might end up doing only a
      partial page IO (or none at all) when ->writepage() is actually called.
      
      That is the correct thing in general (since we actually often _want_
      only the known-dirty parts of the page to be written out), but the
      shared dirty page handling had implicitly forgotten about these details,
      and had a number of cases where it was doing just the "->writepage()"
      part, without telling the low-level filesystem that the whole page might
      have been re-dirtied as part of being mapped writably into user space.
      
      Since most of the time the FS did actually write out the full page, we
      didn't notice this for a loong time, and this needed some really odd
      patterns to trigger.  But it caused occasional corruption with rtorrent
      and with the Debian "apt" database, because both use shared mmaps to
      update the end result.
      
      This fixes it. Finally. After way too much hair-pulling.
      Acked-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
      Acked-by: default avatarMartin J. Bligh <mbligh@google.com>
      Acked-by: default avatarMartin Michlmayr <tbm@cyrius.com>
      Acked-by: default avatarMartin Johansson <martin@fatbob.nu>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Acked-by: default avatarAndrei Popa <andrei.popa@i-neo.ro>
      Cc: High Dickins <hugh@veritas.com>
      Cc: Andrew Morton <akpm@osdl.org>,
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Segher Boessenkool <segher@kernel.crashing.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: Gordon Farquharson <gordonfarquharson@gmail.com>
      Cc: Guillaume Chazarain <guichaz@yahoo.fr>
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Kenneth Cheng <kenneth.w.chen@intel.com>
      Cc: Tobias Diedrich <ranma@tdiedrich.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      7658cc28
  2. 24 Dec, 2006 2 commits
  3. 23 Dec, 2006 5 commits
    • OGAWA Hirofumi's avatar
      [PATCH] arch/i386/pci/mmconfig.c tlb flush fix · 8d1c4819
      OGAWA Hirofumi authored
      We use the fixmap for accessing pci config space in pci_mmcfg_read/write().
      The problem is in pci_exp_set_dev_base(). It is caching a last
      accessed address to avoid calling set_fixmap_nocache() whenever
      pci_mmcfg_read/write() is used.
      
        static inline void pci_exp_set_dev_base(int bus, int devfn)
        {
      	u32 dev_base = base | (bus << 20) | (devfn << 12);
      	if (dev_base != mmcfg_last_accessed_device) {
      		mmcfg_last_accessed_device = dev_base;
      		set_fixmap_nocache(FIX_PCIE_MCFG, dev_base);
      	}
        }
      
                  cpu0                                        cpu1
        ---------------------------------------------------------------------------
          pci_mmcfg_read("device-A")
              pci_exp_set_dev_base()
                  set_fixmap_nocache()
                                                    pci_mmcfg_read("device-B")
                                                        pci_exp_set_dev_base()
                                                            set_fixmap_nocache()
          pci_mmcfg_read("device-B")
              pci_exp_set_dev_base()
                  /* doesn't flush tlb */
      
      But if cpus accessed the above order, the second pci_mmcfg_read() on
      cpu0 doesn't flush the TLB, because "mmcfg_last_accessed_device" is
      device-B.  So, second pci_mmcfg_read() on cpu0 accesses a device-A via
      a previous TLB cache. This problem became the cause of several strange
      behavior.
      
      This patches fixes this situation by adds "mmcfg_last_accessed_cpu" check.
      
      [ Alternatively, we could make a per-cpu mapping area or something. Not
        that it's probably worth it, but if we wanted to avoid all locking and
        instead just disable preemption, that would be the way to go. --Linus ]
      Signed-off-by: default avatarOGAWA Hirofumi <hogawa@miraclelinux.com>
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      8d1c4819
    • Ingo Molnar's avatar
      [PATCH] suspend: fix suspend on single-CPU systems · e1d9fd2e
      Ingo Molnar authored
      Clark Williams reported that suspend doesnt work on his laptop on
      2.6.20-rc1-rt kernels. The bug was introduced by the following cleanup
      commit:
      
       commit 112cecb2
       Author: Siddha, Suresh B <suresh.b.siddha@intel.com>
       Date:   Wed Dec 6 20:34:31 2006 -0800
      
          [PATCH] suspend: don't change cpus_allowed for task initiating the suspend
      
      because with this change 'error' is not initialized to 0 anymore, if
      there are no other online CPUs. (i.e. if the system is single-CPU).
      
      the fix is the initialize it to 0. The really weird thing is that my
      version of gcc does not warn about this non-initialized variable
      situation ...
      
      (also fix the kernel printk in the error branch, it was missing a
       newline)
      Reported-by: default avatarClark Williams <williams@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      e1d9fd2e
    • Linus Torvalds's avatar
      Fix reiserfs after "test_clear_page_dirty()" removal · ffaa8200
      Linus Torvalds authored
      Thanks to Len Brown for testing this fix, since while they have in the
      past, none of my machines run reiserfs at the moment.
      
      Cc: Vladimir V. Saveliev <vs@namesys.com>
      Acked-by: default avatarLen Brown <lenb@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      ffaa8200
    • Linus Torvalds's avatar
      Clean up and export cancel_dirty_page() to modules · 8368e328
      Linus Torvalds authored
      Make cancel_dirty_page() act more like all the other dirty and writeback
      accounting functions: test for "mapping" being NULL, and do the
      NR_FILE_DIRY accounting purely based on mapping_cap_account_dirty()).
      
      Also, add it to the exports, so that modular filesystems can use it.
      Acked-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      8368e328
    • Linus Torvalds's avatar
      Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 · 18ed1c05
      Linus Torvalds authored
      * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (68 commits)
        ACPI: replace kmalloc+memset with kzalloc
        ACPI: Add support for acpi_load_table/acpi_unload_table_id
        fbdev: update after backlight argument change
        ACPI: video: Add dev argument for backlight_device_register
        ACPI: Implement acpi_video_get_next_level()
        ACPI: Kconfig - depend on PM rather than selecting it
        ACPI: fix NULL check in drivers/acpi/osl.c
        ACPI: make drivers/acpi/ec.c:ec_ecdt static
        ACPI: prevent processor module from loading on failures
        ACPI: fix single linked list manipulation
        ACPI: ibm_acpi: allow clean removal
        ACPI: fix git automerge failure
        ACPI: ibm_acpi: respond to workqueue update
        ACPI: dock: add uevent to indicate change in device status
        ACPI: ec: Lindent once again
        ACPI: ec: Change #define to enums there possible.
        ACPI: ec: Style changes.
        ACPI: ec: Acquire Global Lock under EC mutex.
        ACPI: ec: Drop udelay() from poll mode. Loop by reading status field instead.
        ACPI: ec: Rename gpe_bit to gpe
        ...
      18ed1c05
  4. 22 Dec, 2006 32 commits