1. 06 May, 2012 10 commits
    • Jan Kara's avatar
      writeback: Avoid iput() from flusher thread · 169ebd90
      Jan Kara authored
      Doing iput() from flusher thread (writeback_sb_inodes()) can create problems
      because iput() can do a lot of work - for example truncate the inode if it's
      the last iput on unlinked file. Some filesystems depend on flusher thread
      progressing (e.g. because they need to flush delay allocated blocks to reduce
      allocation uncertainty) and so flusher thread doing truncate creates
      interesting dependencies and possibilities for deadlocks.
      
      We get rid of iput() in flusher thread by using the fact that I_SYNC inode
      flag effectively pins the inode in memory. So if we take care to either hold
      i_lock or have I_SYNC set, we can get away without taking inode reference
      in writeback_sb_inodes().
      
      As a side effect of these changes, we also fix possible use-after-free in
      wb_writeback() because inode_wait_for_writeback() call could try to reacquire
      i_lock on the inode that was already free.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      169ebd90
    • Jan Kara's avatar
      vfs: Rename end_writeback() to clear_inode() · dbd5768f
      Jan Kara authored
      After we moved inode_sync_wait() from end_writeback() it doesn't make sense
      to call the function end_writeback() anymore. Rename it to clear_inode()
      which well says what the function really does - set I_CLEAR flag.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      dbd5768f
    • Jan Kara's avatar
      vfs: Move waiting for inode writeback from end_writeback() to evict_inode() · 7994e6f7
      Jan Kara authored
      Currently, I_SYNC can never be set when evict_inode() (and thus
      end_writeback()) is called because flusher thread holds inode reference while
      inode is under writeback. As a result inode_sync_wait() in those places
      currently does nothing. However that is going to change and unveils problems
      with calling inode_sync_wait() from end_writeback(). Several filesystems call
      end_writeback() after they have deleted the inode (btrfs, gfs2, ...) and other
      filesystems (ext3, ext4, reiserfs, ...) can deadlock when waiting for I_SYNC
      because they call end_writeback() from within a transaction.
      
      To avoid these issues, we move inode_sync_wait() into evict_inode() before
      calling ->evict_inode(). That way we preserve the current property that
      ->evict_inode() and writeback never run in parallel and all filesystems are
      safe.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      7994e6f7
    • Jan Kara's avatar
      writeback: Refactor writeback_single_inode() · 4f8ad655
      Jan Kara authored
      The code in writeback_single_inode() is relatively complex. The list requeing
      logic makes sense only for flusher thread but not really for sync_inode() or
      write_inode_now() callers. Also when we want to get rid of inode references
      held by flusher thread, we will need a special I_SYNC handling there.
      
      So separate part of writeback_single_inode() which does the real writeback work
      into __writeback_single_inode() and make writeback_single_inode() do only stuff
      necessary for callers writing only one inode, moving the special list handling
      into writeback_sb_inodes(). As a sideeffect this fixes a possible race where we
      could skip some inode during sync(2) because other writer refiled it from b_io
      to b_dirty list. Also I_SYNC handling is moved into the callers of
      __writeback_single_inode() to make locking easier.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      4f8ad655
    • Jan Kara's avatar
      writeback: Remove wb->list_lock from writeback_single_inode() · f0d07b7f
      Jan Kara authored
      writeback_single_inode() doesn't need wb->list_lock for anything on entry now.
      So remove the requirement. This makes locking of writeback_single_inode()
      temporarily awkward (entering with i_lock, returning with i_lock and
      wb->list_lock) but it will be sanitized in the next patch.
      
      Also inode_wait_for_writeback() doesn't need wb->list_lock for anything. It was
      just taking it to make usage convenient for callers but with
      writeback_single_inode() changing it's not very convenient anymore. So remove
      the lock from that function.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      f0d07b7f
    • Jan Kara's avatar
      writeback: Separate inode requeueing after writeback · ccb26b5a
      Jan Kara authored
      Move inode requeueing after inode has been written out into a separate
      function.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      ccb26b5a
    • Jan Kara's avatar
      writeback: Move I_DIRTY_PAGES handling · 6290be1c
      Jan Kara authored
      Instead of clearing I_DIRTY_PAGES and resetting it when we didn't succeed in
      writing them all, just clear the bit only when we succeeded writing all the
      pages. We also move the clearing of the bit close to other i_state handling to
      separate it from writeback list handling. This is desirable because list
      handling will differ for flusher thread and other writeback_single_inode()
      callers in future. No filesystem plays any tricks with I_DIRTY_PAGES (like
      checking it in ->writepages or ->write_inode implementation) so this movement
      is safe.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      6290be1c
    • Jan Kara's avatar
      writeback: Move requeueing when I_SYNC set to writeback_sb_inodes() · cc1676d9
      Jan Kara authored
      When writeback_single_inode() is called on inode which has I_SYNC already
      set while doing WB_SYNC_NONE, inode is moved to b_more_io list. However
      this makes sense only if the caller is flusher thread. For other callers of
      writeback_single_inode() it doesn't really make sense and may be even wrong
      - flusher thread may be doing WB_SYNC_ALL writeback in parallel.
      
      So we move requeueing from writeback_single_inode() to writeback_sb_inodes().
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      cc1676d9
    • Jan Kara's avatar
      writeback: Move clearing of I_SYNC into inode_sync_complete() · 365b94ae
      Jan Kara authored
      Move clearing of I_SYNC into inode_sync_complete().  It is more logical to have
      clearing of I_SYNC bit and waking of waiters in one place. Also later we will
      have two places needing to clear I_SYNC and wake up waiters so this allows them
      to use the common helper. Moving of I_SYNC clearing to a later stage of
      writeback_single_inode() is safe since we hold i_lock all the time.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      365b94ae
    • Fengguang Wu's avatar
      writeback: initialize global_dirty_limit · 68809c71
      Fengguang Wu authored
      This prevents global_dirty_limit from remaining 0 (the initial value)
      for long time, since it's only updated in update_dirty_limit() when
      above the dirty freerun area.
      
      It will avoid unexpected consequences when some random code use it as a
      convenient approximation of the global dirty threshold.
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      68809c71
  2. 25 Apr, 2012 1 commit
  3. 14 Apr, 2012 7 commits
    • H Hartley Sweeten's avatar
      mm: page-writeback.c: local functions should not be exposed globally · 18cf8cf8
      H Hartley Sweeten authored
      The function global_dirtyable_memory is only referenced in this file and
      should be marked static to prevent it from being exposed globally.
      
      This quiets the sparse warning:
      
      warning: symbol 'global_dirtyable_memory' was not declared. Should it be static?
      Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      18cf8cf8
    • Linus Torvalds's avatar
      Merge branch 'systemh-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux · 668ce0ac
      Linus Torvalds authored
      Pull system.h fixups for less common arch's from Paul Gortmaker:
       "Here is what is hopefully the last of the system.h related fixups.
      
        The fixes for Alpha and ia64 are code relocations consistent with what
        was done for the more mainstream architectures.  Note that the
        diffstat lines removed vs lines added are not the same since I've
        fixed some of the whitespace issues in the relocated code blocks.
        However they are functionally the same.  Compile tested locally, plus
        these two have been in linux-next for a while.
      
        There is also a trivial one line system.h related fix for the Tilera
        arch from Chris Metcalf to fix an implict include.."
      
      * 'systemh-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
        irq_work: fix compile failure on tile from missing include
        ia64: populate the cmpxchg header with appropriate code
        alpha: fix build failures from system.h dismemberment
      668ce0ac
    • Linus Torvalds's avatar
      Merge tag 'fbdev-fixes-for-3.4-1' of git://github.com/schandinat/linux-2.6 · a1c0cad3
      Linus Torvalds authored
      Pull fbdev fixes from Florian Tobias Schandinat:
       - a compile fix for au1*fb
       - a fix to make kyrofb usable on x86_64
       - a fix for uvesafb to prevent an oops due to NX-protection
      
       "The fix for kyrofb is a bit large but it's just replacing "unsigned
        long" by "u32" for 64 bit compatibility."
      
      * tag 'fbdev-fixes-for-3.4-1' of git://github.com/schandinat/linux-2.6:
        video:uvesafb: Fix oops that uvesafb try to execute NX-protected page
        fbdev: fix au1*fb builds
        kyrofb: fix on x86_64
      a1c0cad3
    • Linus Torvalds's avatar
      Merge branch 'for-linus-min' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 659e45d8
      Linus Torvalds authored
      Pull the minimal btrfs branch from Chris Mason:
       "We have a use-after-free in there, along with errors when mount -o
        discard is enabled, and a BUG_ON(we should compile with UP more
        often)."
      
      * 'for-linus-min' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: use commit root when loading free space cache
        Btrfs: fix use-after-free in __btrfs_end_transaction
        Btrfs: check return value of bio_alloc() properly
        Btrfs: remove lock assert from get_restripe_target()
        Btrfs: fix eof while discarding extents
        Btrfs: fix uninit variable in repair_eb_io_failure
        Revert "Btrfs: increase the global block reserve estimates"
      659e45d8
    • Linus Torvalds's avatar
      Merge branch 'for-3.4/drivers' of git://git.kernel.dk/linux-block · c104f1fa
      Linus Torvalds authored
      Pull block driver bits from Jens Axboe:
      
       - A series of fixes for mtip32xx.  Most from Asai at Micron, but also
         one from Greg, getting rid of the dependency on PCIE_HOTPLUG.
      
       - A few bug fixes for xen-blkfront, and blkback.
      
       - A virtio-blk fix for Vivek, making resize actually work.
      
       - Two fixes from Stephen, making larger transfers possible on cciss.
         This is needed for tape drive support.
      
      * 'for-3.4/drivers' of git://git.kernel.dk/linux-block:
        block: mtip32xx: remove HOTPLUG_PCI_PCIE dependancy
        mtip32xx: dump tagmap on failure
        mtip32xx: fix handling of commands in various scenarios
        mtip32xx: Shorten macro names
        mtip32xx: misc changes
        mtip32xx: Add new sysfs entry 'status'
        mtip32xx: make setting comp_time as common
        mtip32xx: Add new bitwise flag 'dd_flag'
        mtip32xx: fix error handling in mtip_init()
        virtio-blk: Call revalidate_disk() upon online disk resize
        xen/blkback: Make optional features be really optional.
        xen/blkback: Squash the discard support for 'file' and 'phy' type.
        mtip32xx: fix incorrect value set for drv_cleanup_done, and re-initialize and start port in mtip_restart_port()
        cciss: Fix scsi tape io with more than 255 scatter gather elements
        cciss: Initialize scsi host max_sectors for tape drive support
        xen-blkfront: make blkif_io_lock spinlock per-device
        xen/blkfront: don't put bdev right after getting it
        xen-blkfront: use bitmap_set() and bitmap_clear()
        xen/blkback: Enable blkback on HVM guests
        xen/blkback: use grant-table.c hypercall wrappers
      c104f1fa
    • Linus Torvalds's avatar
      Merge branch 'for-3.4/core' of git://git.kernel.dk/linux-block · d8dd0b6d
      Linus Torvalds authored
      Pull block core bits from Jens Axboe:
       "It's a nice and quiet round this time, since most of the tricky stuff
        has been pushed to 3.5 to give it more time to mature.  After a few
        hectic block IO core changes for 3.3 and 3.2, I'm quite happy with a
        slow round.
      
        Really minor stuff in here, the only real functional change is making
        the auto-unplug threshold a per-queue entity.  The threshold is set so
        that it's low enough that we don't hold off IO for too long, but still
        big enough to get a nice benefit from the batched insert (and hence
        queue lock cost reduction).  For raid configurations, this currently
        breaks down."
      
      * 'for-3.4/core' of git://git.kernel.dk/linux-block:
        block: make auto block plug flush threshold per-disk based
        Documentation: Add sysfs ABI change for cfq's target latency.
        block: Make cfq_target_latency tunable through sysfs.
        block: use lockdep_assert_held for queue locking
        block: blk_alloc_queue_node(): use caller's GFP flags instead of GFP_KERNEL
      d8dd0b6d
    • Kevin Hilman's avatar
      cpufreq: OMAP: fix build errors: depends on ARCH_OMAP2PLUS · 2d59dcfb
      Kevin Hilman authored
      The OMAP driver needs a 'depends on ARCH_OMAP2PLUS' since it only
      builds for OMAP2+ platforms.
      
      This 'depends on' was in the original patch from Russell King, but was
      erroneously removed by me when making this option user-selectable in
      commit b09db45c (cpufreq: OMAP driver depends CPUfreq tables.)  This
      patch remedies that.
      
      Apologies to Russell King for breaking his originally working patch.
      
      Also, thanks to Grazvydas Ignotas for reporting the same problem.
      
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Grazvydas Ignotas <notasas@gmail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2d59dcfb
  4. 13 Apr, 2012 14 commits
  5. 12 Apr, 2012 8 commits
    • Linus Torvalds's avatar
      Merge tag 'usb-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 7c427f45
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a number of fixes for the USB core and drivers for 3.4-rc2
      
        Lots of tiny xhci fixes here, a few usb-serial driver fixes and new
        device ids, and a smattering of other minor fixes in different USB
        drivers.
      
        Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
      
      * tag 'usb-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (30 commits)
        USB: update usbtmc api documentation
        xHCI: Correct the #define XHCI_LEGACY_DISABLE_SMI
        xHCI: use gfp flags from caller instead of GFP_ATOMIC
        xHCI: add XHCI_RESET_ON_RESUME quirk for VIA xHCI host
        USB: fix bug of device descriptor got from superspeed device
        xhci: Fix register save/restore order.
        xhci: Restore event ring dequeue pointer on resume.
        xhci: Don't write zeroed pointers to xHC registers.
        xhci: Warn when hosts don't halt.
        xhci: don't re-enable IE constantly
        usb: xhci: fix section mismatch in linux-next
        xHCI: correct to print the true HSEE of USBCMD
        USB: serial: fix race between probe and open
        UHCI: hub_status_data should indicate if ports are resuming
        EHCI: keep track of ports being resumed and indicate in hub_status_data
        USB: fix race between root-hub suspend and remote wakeup
        USB: sierra: add support for Sierra Wireless MC7710
        USB: ftdi_sio: fix race condition in TIOCMIWAIT, and abort of TIOCMIWAIT when the device is removed
        USB: ftdi_sio: fix status line change handling for TIOCMIWAIT and TIOCGICOUNT
        USB: don't ignore suspend errors for root hubs
        ...
      7c427f45
    • Linus Torvalds's avatar
      Merge tag 'tty-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · f4f9c1ac
      Linus Torvalds authored
      Pull tty and serial fixes from Greg KH:
       "Here are some tty and serial fixes for 3.4-rc2.
      
        Most important here is the pl011 fix, which has been reported by about
        100 different people, which means more people use it than I expected
        :)
      
        There are also some 8250 driver reverts due to some problems reported
        by them.  And other minor fixes as well.
      
        Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
      
      * tag 'tty-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        pch_uart: Add Kontron COMe-mTT10 uart clock quirk
        pch_uart: Fix MSI setting issue
        serial/8250_pci: add a "force background timer" flag and use it for the "kt" serial port
        Revert "serial/8250_pci: setup-quirk workaround for the kt serial controller"
        Revert "serial/8250_pci: init-quirk msi support for kt serial controller"
        tty/serial/omap: console can only be built-in
        serial: samsung: fix omission initialize ulcon in reset port fn()
        printk(): add KERN_CONT where needed in hpet and vt code
        tty/serial: atmel_serial: fix RS485 half-duplex problem
        tty: serial: altera_uart: Check for NULL platform_data in probe.
        isdn/gigaset: use gig_dbg() for debugging output
        omap-serial: Fix the error handling in the omap_serial probe
        serial: PL011: move interrupt clearing
      f4f9c1ac
    • Linus Torvalds's avatar
      Merge tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 3dbc35a3
      Linus Torvalds authored
      Pull staging tree fixes from Greg KH:
       "Here are a number of bugfixes for the drivers/staging/ portion of the
        kernel that have been reported recently.
      
        Nothing major here, with maybe the exception of the ramster code can
        now be built so it is enabled in the build again, and lots of memory
        leaks that people like to have fixed on their systems.
      
        Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
      
      * tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: android: fix mem leaks in __persistent_ram_init()
        staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl()
        staging: iio: hmc5843: Fix crash in probe function.
        staging/xgifb: fix display on XGI Volari Z11m cards
        Staging: android: timed_gpio: Fix resource leak in timed_gpio_probe error paths
        android: make persistent_ram based drivers depend on HAVE_MEMBLOCK
        staging: iio: ak8975: Remove i2c client data corruption
        staging: drm/omap: move where DMM driver is registered
        staging: zsmalloc: fix memory leak
        Staging: rts_pstor: off by one in for loop
        staging: ozwpan: Added new maintainer for ozwpan
        staging:rts_pstor:Avoid "Bad target number" message when probing driver
        staging:rts_pstor:Fix possible panic by NULL pointer dereference
        Staging: vt6655-6: check keysize before memcpy()
        staging/media/as102: Don't call release_firmware() on uninitialized variable
        staging:iio:core add missing increment of loop index in iio_map_array_unregister()
        staging: ramster: unbreak my heart
        staging/vme: Fix module parameters
        staging: sep: Fix sign of error
      3dbc35a3
    • Linus Torvalds's avatar
      Merge tag 'driver-core-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · f5ad5010
      Linus Torvalds authored
      Pull driver core and kobject fixes from Greg KH:
       "Here are some minor fixes for the driver core and kobjects that people
        have reported recently.
      
        Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
      
      * tag 'driver-core-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        kobject: provide more diagnostic info for kobject_add_internal() failures
        sysfs: handle 'parent deleted before child added'
        sysfs: Prevent crash on unset sysfs group attributes
        sysfs: Update the name hash for an entry after changing the namespace
        drivers/base: fix compiler warning in SoC export driver - idr should be ida
        drivers/base: Remove unneeded spin_lock_init call for soc_lock
      f5ad5010
    • Linus Torvalds's avatar
      Merge tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6 · b3dfd76c
      Linus Torvalds authored
      Pull a fix for the recent irqdomain bug fixes from Grant Likely:
       "I flubbed one patch in the last pull request which broke a format
        string on 64 bit platforms.  Here's the fix."
      
      * tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6:
        irq_domain: fix type mismatch in debugfs output format
      b3dfd76c
    • Grant Likely's avatar
      irq_domain: fix type mismatch in debugfs output format · 5269a9ab
      Grant Likely authored
      sizeof(void*) returns an unsigned long, but it was being used as a width parameter to a "%-*s" format string which requires an int.  On 64 bit platforms this causes a type mismatch:
      
          linux/kernel/irq/irqdomain.c:575: warning: field width should have type
          'int', but argument 6 has type 'long unsigned int'
      
      This change casts the size to an int so printf gets the right data type.
      Reported-by: default avatarAndreas Schwab <schwab@linux-m68k.org>
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Cc: David Daney <david.daney@cavium.com>
      5269a9ab
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9b1ef1de
      Linus Torvalds authored
      Pull trivial perf build failure fix from Thomas Gleixner.
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf tools: Fix getrusage() related build failure on glibc trunk
      9b1ef1de
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ccb1ec95
      Linus Torvalds authored
      Pull timer fixes from Thomas Gleixner:
       "The itimer removal one is not strictly a fix, but I really wanted to
        avoid a rebase of the urgent ones."
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        Revert "clocksource: Load the ACPI PM clocksource asynchronously"
        clockevents: tTack broadcast device mode change in tick_broadcast_switch_to_oneshot()
        itimer: Use printk_once instead of WARN_ONCE
        nohz: Fix stale jiffies update in tick_nohz_restart()
        tick: Document TICK_ONESHOT config option
        proc: stats: Use arch_idle_time for idle and iowait times if available
        itimer: Schedule silent NULL pointer fixup in setitimer() for removal
      ccb1ec95