Skip to content
  1. Mar 09, 2015
    • Linus Torvalds's avatar
      Merge tag 'staging-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 47df986b
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are some IIO and staging driver fixes for 4.0-rc3.
      
        Details are in the shortlog, nothing major, mostly IIO fixes for
        reported issues.
      
        All have been in linux-next successfully"
      
      * tag 'staging-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits)
        staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel
        staging: comedi: vmk80xx: remove "firmware version" kernel messages
        staging: comedi: comedi_isadma: fix "stalled" detect in comedi_isadma_disable_on_sample()
        iio: ak8975: fix AK09911 dependencies
        iio: common: ssp_sensors: Protect PM-only functions to kill warning
        IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc
        Revert "iio:humidity:si7020: fix pointer to i2c client"
        iio: light: gp2ap020a00f: Select REGMAP_I2C
        iio: light: jsa1212: Select REGMAP_I2C
        iio: ad5686: fix optional reference voltage declaration
        iio:adc:mcp3422 Fix incorrect scales table
        iio: mxs-lradc: fix iio channel map regression
        iio: imu: adis16400: Fix sign extension
        staging: iio: ad2s1200: Fix sign extension
        iio: mxs-lradc: only update the buffer when its conversions have finished
        iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions
        iio: mxs-lradc: make ADC reads not disable touchscreen interrupts
        iio: mxs-lradc: separate touchscreen and buffer virtual channels
        iio: imu: inv_mpu6050: Prevent dereferencing NULL
        iio: iadc: wait_for_completion_timeout time in jiffies
        ...
      47df986b
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 29191c7f
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are two char/misc fixes for 4.0-rc3.
      
        One is a reported binder driver fix needed due to a change in the mm
        core that happened in 4.0-rc1.  Another is a mei driver fix that
        resolves a reported issue in that driver.
      
        Both have been in linux-next for a while"
      
      * tag 'char-misc-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        mei: make device disabled on stop unconditionally
        android: binder: fix binder mmap failures
      29191c7f
    • Linus Torvalds's avatar
      Merge tag 'cc-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · b0bc6572
      Linus Torvalds authored
      Pull "code of conflict" from Greg KH:
       "This file tries to set the rational basis for our code reviews, gives
        some advice on how to conduct them, and provides an excalation channel
        for any kernel developers if they so desire it"
      
      [ Let's see how this works ]
      
      * tag 'cc-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        Code of Conflict
      b0bc6572
  2. Mar 08, 2015
  3. Mar 07, 2015
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · af13e867
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Radeon, imx, msm, and i915 fixes.
      
        The msm, imx and i915 ones are fairly run of the mill.
      
        Radeon had some DP audio and posting reads for irq fixes, along with a
        fix for 32-bit kernels with new cards, we were using unsigned long to
        represent GPU side memory space, but since that changed size on 32 vs
        64 cards with lots of VRAM failed, so the change has no effect on
        x86-64, just moves to using uint64_t instead"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (35 commits)
        drm/msm: kexec fixes
        drm/msm/mdp5: fix cursor blending
        drm/msm/mdp5: fix cursor ROI
        drm/msm/atomic: Don't leak atomic commit object when commit fails
        drm/msm/mdp5: Avoid flushing registers when CRTC is disabled
        drm/msm: update generated headers (add 6th lm.base entry)
        drm/msm/mdp5: fixup "drm/msm: fix fallout of atomic dpms changes"
        drm/ttm: device address space != CPU address space
        drm/mm: Support 4 GiB and larger ranges
        drm/i915: gen4: work around hang during hibernation
        drm/i915: Check for driver readyness before handling an underrun interrupt
        drm/radeon: fix interlaced modes on DCE8
        drm/radeon: fix DRM_IOCTL_RADEON_CS oops
        drm/radeon: do a posting read in cik_set_irq
        drm/radeon: do a posting read in si_set_irq
        drm/radeon: do a posting read in evergreen_set_irq
        drm/radeon: do a posting read in r600_set_irq
        drm/radeon: do a posting read in rs600_set_irq
        drm/radeon: do a posting read in r100_set_irq
        radeon/audio: fix DP audio on DCE6
        ...
      af13e867
    • Matt Porter's avatar
      i2c: imx: add required clocks property to binding · 5d232112
      Matt Porter authored
      
      
      A clock specifier is required for i.MX I2C and is
      provided in all DTS implementations. Add this to the
      list of required properties in the binding.
      
      Signed-off-by: default avatarMatt Porter <mporter@konsulko.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      5d232112
    • Andy Shevchenko's avatar
      i2c: designware-baytrail: baytrail_i2c_acquire() might sleep · ebf2ef8f
      Andy Shevchenko authored
      
      
      This patch marks baytrail_i2c_acquire() that it might sleep. Also it chages
      while-loop to do-while and, though it is matter of taste, gives a chance to
      check one more time before report a timeout.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      ebf2ef8f
    • Andy Shevchenko's avatar
      i2c: designware-baytrail: cross-check lock functions · 30be774b
      Andy Shevchenko authored
      
      
      It seems the idea behind the cross-check is to prevent acquire semaphore when
      there is no release callback and vice versa. Thus, patch fixes a typo.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      30be774b
    • Andy Shevchenko's avatar
      i2c: designware-baytrail: fix sparse warnings · c8e043e6
      Andy Shevchenko authored
      
      
      There is no need to export functions that are used as the callbacks in the
      struct dw_i2c_dev. Otherwise we get the following warnings:
      
      drivers/i2c/busses/i2c-designware-baytrail.c:63:5: warning: symbol 'baytrail_i2c_acquire' was not declared. Should it be static?
      drivers/i2c/busses/i2c-designware-baytrail.c:114:6: warning: symbol 'baytrail_i2c_release' was not declared. Should it be static?
      
      While here, do few indentation fixes, remove i2c_dw_eval_lock_support() from
      functions exported to the modules and redundant assignment of local sem
      variable.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      c8e043e6
    • Andy Shevchenko's avatar
      i2c: designware-baytrail: fix typo in error path · 259aada4
      Andy Shevchenko authored
      
      
      It seems we have same message for different return values in get_sem() and
      baytrail_i2c_acquire(). I suspect this is just a typo, so this patch fixes it.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      259aada4
    • Andy Shevchenko's avatar
      i2c: designware-baytrail: describe magic numbers · 9b5c9f04
      Andy Shevchenko authored
      
      
      The patch converts hardcoded numerical constants to a named ones.
      
      While here, align the variable name in get_sem() and reset_semaphore().
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      9b5c9f04
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 84399bb0
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "Outside of misc fixes, Filipe has a few fsync corners and we're
        pulling in one more of Josef's fixes from production use here"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref.
        Btrfs: fix data loss in the fast fsync path
        Btrfs: remove extra run_delayed_refs in update_cowonly_root
        Btrfs: incremental send, don't rename a directory too soon
        btrfs: fix lost return value due to variable shadowing
        Btrfs: do not ignore errors from btrfs_lookup_xattr in do_setxattr
        Btrfs: fix off-by-one logic error in btrfs_realloc_node
        Btrfs: add missing inode update when punching hole
        Btrfs: abort the transaction if we fail to update the free space cache inode
        Btrfs: fix fsync race leading to ordered extent memory leaks
      84399bb0
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching · 0d9b9c16
      Linus Torvalds authored
      Pull livepatching fix from Jiri Kosina:
       "Fix an RCU unlock misplacement in live patching infrastructure, from
        Peter Zijlstra"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
        livepatch: fix RCU usage in klp_find_external_symbol()
      0d9b9c16
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal · 5b3b5921
      Linus Torvalds authored
      Pull thermal management fixes from Eduardo Valentin:
       "Specifics:
      
         - adding Lukasz as maintainer of samsung thermal driver.
         - driver fixes: exynos and int430x.
         - one fix in the exynos cpufreq driver related to cpu cooling (acked
           by cpufreq maintainer).
         - fix default sysfs attributes of cooling devices
      
        Note: I am sending this pull on Rui's behalf while he fixes issues in his Linux box"
      
      * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
        thermal: Make sysfs attributes of cooling devices default attributes
        Thermal/int340x: Fix memleak for aux trip
        MAINTAINERS: Add entry for SAMSUNG THERMAL DRIVER
        cpufreq: exynos: Use simple approach to asses if cpu cooling can be used
        thermal: exynos: Fix wrong control of power down detection mode for Exynos7
      5b3b5921
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2015-03-05' of git://anongit.freedesktop.org/drm-intel into drm-fixes · f6bec6ea
      Dave Airlie authored
      two fixes, both cc'd stable.
      
      * tag 'drm-intel-fixes-2015-03-05' of git://anongit.freedesktop.org/drm-intel:
        drm/i915: gen4: work around hang during hibernation
        drm/i915: Check for driver readyness before handling an underrun interrupt
      f6bec6ea
    • Dave Airlie's avatar
      Merge tag 'v4.0-rc2' into drm-fixes · b0b20ce3
      Dave Airlie authored
      Linux 4.0-rc2
      
      Merging this manually as the i915 change is in it,
      and intel fixes are on top of this
      b0b20ce3
    • Linus Torvalds's avatar
      Merge tag 'sound-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 5f237425
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Here are a few more ASoC changes that have been gathered since rc1,
        but it's still fairly calm over all.  The only largish LOC is found in
        atmel driver, and it's just a removal of broken non-DT stuff.  The
        rest are all small driver-specific fixes, nothing to worry much"
      
      * tag 'sound-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (26 commits)
        ALSA: hda - One more Dell macine needs DELL1_MIC_NO_PRESENCE quirk
        ALSA: opl3: small array underflow
        ALSA: line6: Clamp values correctly
        ALSA: msnd: add some missing curly braces
        ASoC: omap-pcm: Correct dma mask
        ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
        ASoC: sam9g20_wm8731: drop machine_is_xxx
        ALSA: dice: fix wrong offsets for Dice interface
        ALSA: oxfw: fix a condition and return code in start_stream()
        ASoC: OMAP: mcbsp: Fix CLKX and CLKR pinmux when used as inputs
        ASoC: rt5677: Correct the routing paths of that after IF1/2 DACx Mux
        ASoC: sta32x: fix register range in regmap.
        ASoC: rt5670: Set RT5670_IRQ_CTRL1 non volatile
        ASoC: Intel: reset the DSP while suspending
        ASoC: Intel: save and restore the CSR register
        ASoC: Intel: update MMX ID to 3
        ASoC: max98357a: Add missing header files
        ASoC: cirrus: tlv320aic23 needs I2C
        ASoC: Samsung: add missing I2C/SPI dependencies
        ASoC: rt5670: Fix the speaker mono output issue
        ...
      5f237425
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 39ed853a
      Linus Torvalds authored
      Pull power management and ACPI fixes from Rafael Wysocki:
       "These are fixes for recent regressions (ACPI resources management,
        suspend-to-idle), stable-candidate fixes (ACPI backlight), fixes
        related to the wakeup IRQ management changes made in v3.18, other
        fixes (suspend-to-idle, cpufreq ppc driver) and a couple of cleanups
        (suspend-to-idle, generic power domains, ACPI backlight).
      
        Specifics:
      
         - Fix ACPI resources management problems introduced by the recent
           rework of the code in question (Jiang Liu) and a build issue
           introduced by those changes (Joachim Nilsson).
      
         - Fix a recent suspend-to-idle regression on systems where entering
           idle states causes local timers to stop, prevent suspend-to-idle
           from crashing in restricted configurations (no cpuidle driver,
           cpuidle disabled etc.) and clean up the idle loop somewhat while at
           it (Rafael J Wysocki).
      
         - Fix build problem in the cpufreq ppc driver (Geert Uytterhoeven).
      
         - Allow the ACPI backlight driver module to be loaded if ACPI is
           disabled which helps the i915 driver in those configurations
           (stable-candidate) and change the code to help debug unusual use
           cases (Chris Wilson).
      
         - Wakeup IRQ management changes in v3.18 caused some drivers on the
           at91 platform to trigger a warning from the IRQ core related to an
           unexpected combination of interrupt action handler flags.  However,
           on at91 a timer IRQ is shared with some other devices (including
           system wakeup ones) and that leads to the unusual combination of
           flags in question.
      
           To make it possible to avoid the warning introduce a new interrupt
           action handler flag (which can be used by drivers to indicate the
           special case to the core) and rework the problematic at91 drivers
           to use it and work as expected during system suspend/resume.  From
           Boris Brezillon, Rafael J Wysocki and Mark Rutland.
      
         - Clean up the generic power domains subsystem's debugfs interface
           (Kevin Hilman)"
      
      * tag 'pm+acpi-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        genirq / PM: describe IRQF_COND_SUSPEND
        tty: serial: atmel: rework interrupt and wakeup handling
        watchdog: at91sam9: request the irq with IRQF_NO_SUSPEND
        cpuidle / sleep: Use broadcast timer for states that stop local timer
        clk: at91: implement suspend/resume for the PMC irqchip
        rtc: at91rm9200: rework wakeup and interrupt handling
        rtc: at91sam9: rework wakeup and interrupt handling
        PM / wakeup: export pm_system_wakeup symbol
        genirq / PM: Add flag for shared NO_SUSPEND interrupt lines
        ACPI / video: Propagate the error code for acpi_video_register
        ACPI / video: Load the module even if ACPI is disabled
        PM / Domains: cleanup: rename gpd -> genpd in debugfs interface
        cpufreq: ppc: Add missing #include <asm/smp.h>
        x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around BIOS bugs
        x86/PCI/ACPI: Ignore resources consumed by host bridge itself
        cpuidle: Clean up fallback handling in cpuidle_idle_call()
        cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze() too
        idle / sleep: Avoid excessive disabling and enabling interrupts
        PCI: versatile: Update for list_for_each_entry() API change
        genirq / PM: better describe IRQF_NO_SUSPEND semantics
      39ed853a
    • Linus Torvalds's avatar
      Merge tag 'locks-v4.0-3' of git://git.samba.org/jlayton/linux · 7c5bde7a
      Linus Torvalds authored
      Pull file locking fix from Jeff Layton:
       "Just a single patch to fix a memory leak that Daniel Wagner discovered
        while doing some testing with leases"
      
      * tag 'locks-v4.0-3' of git://git.samba.org/jlayton/linux:
        locks: fix fasync_struct memory leak in lease upgrade/downgrade handling
      7c5bde7a
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-4.0-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 1b1bd561
      Linus Torvalds authored
      Pull NFS client bugfixes from Trond Myklebust:
       "Highlights include:
      
         - Fix a regression in the NFSv4 open state recovery code
         - Fix a regression in the NFSv4 close code
         - Fix regressions and side-effects of the loop-back mounted NFS fixes
           in 3.18, that cause the NFS read() syscall to return EBUSY.
         - Fix regressions around the readdirplus code and how it interacts
           with the VFS lazy unmount changes that went into v3.18.
         - Fix issues with out-of-order RPC call replies replacing updated
           attributes with stale ones (particularly after a truncate()).
         - Fix an underflow checking issue with RPC/RDMA credits
         - Fix a number of issues with the NFSv4 delegation return/free code.
         - Fix issues around stale NFSv4.1 leases when doing a mount"
      
      * tag 'nfs-for-4.0-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (24 commits)
        NFSv4.1: Clear the old state by our client id before establishing a new lease
        NFSv4: Fix a race in NFSv4.1 server trunking discovery
        NFS: Don't write enable new pages while an invalidation is proceeding
        NFS: Fix a regression in the read() syscall
        NFSv4: Ensure we skip delegations that are already being returned
        NFSv4: Pin the superblock while we're returning the delegation
        NFSv4: Ensure we honour NFS_DELEGATION_RETURNING in nfs_inode_set_delegation()
        NFSv4: Ensure that we don't reap a delegation that is being returned
        NFS: Fix stateid used for NFS v4 closes
        NFSv4: Don't call put_rpccred() under the rcu_read_lock()
        NFS: Don't require a filehandle to refresh the inode in nfs_prime_dcache()
        NFSv3: Use the readdir fileid as the mounted-on-fileid
        NFS: Don't invalidate a submounted dentry in nfs_prime_dcache()
        NFSv4: Set a barrier in the update_changeattr() helper
        NFS: Fix nfs_post_op_update_inode() to set an attribute barrier
        NFS: Remove size hack in nfs_inode_attrs_need_update()
        NFSv4: Add attribute update barriers to delegreturn and pNFS layoutcommit
        NFS: Add attribute update barriers to NFS writebacks
        NFS: Set an attribute barrier on all updates
        NFS: Add attribute update barriers to nfs_setattr_update_inode()
        ...
      1b1bd561
  4. Mar 06, 2015
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v4.0-rc2' of... · 4fda87df
      Takashi Iwai authored
      Merge tag 'asoc-fix-v4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v4.0
      
      A few driver specific fixes here, none of them earth shattering in
      themselves, that have accumliated since the opening of the merge window.
      4fda87df
    • Hui Wang's avatar
      ALSA: hda - One more Dell macine needs DELL1_MIC_NO_PRESENCE quirk · 70658b99
      Hui Wang authored
      Cc: <stable@vger.kernel.org>
      BugLink: https://bugs.launchpad.net/bugs/1428947
      
      
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      70658b99
    • Dan Carpenter's avatar
      ALSA: opl3: small array underflow · d1243806
      Dan Carpenter authored
      
      
      There is a missing lower bound check on "pitchbend" so it means we can
      read up to 6 elements before the start of the opl3_note_table[] array.
      
      Thanks to Clemens Ladisch for his help with this patch.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d1243806
    • Laura Abbott's avatar
      kernel/module.c: Update debug alignment after symtable generation · 168e47f2
      Laura Abbott authored
      
      
      When CONFIG_DEBUG_SET_MODULE_RONX is enabled, the sizes of
      module sections are aligned up so appropriate permissions can
      be applied. Adjusting for the symbol table may cause them to
      become unaligned. Make sure to re-align the sizes afterward.
      
      Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      168e47f2
    • Laura Abbott's avatar
      arm64: Don't use is_module_addr in setting page attributes · 8b5f5a07
      Laura Abbott authored
      
      
      The set_memory_* functions currently only support module
      addresses. The addresses are validated using is_module_addr.
      That function is special though and relies on internal state
      in the module subsystem to work properly. At the time of
      module initialization and calling set_memory_*, it's too early
      for is_module_addr to work properly so it always returns
      false. Rather than be subject to the whims of the module state,
      just bounds check against the module virtual address range.
      
      Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      8b5f5a07
    • Quentin Casasnovas's avatar
      Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref. · dd9ef135
      Quentin Casasnovas authored
      
      
      Improper arithmetics when calculting the address of the extended ref could
      lead to an out of bounds memory read and kernel panic.
      
      Signed-off-by: default avatarQuentin Casasnovas <quentin.casasnovas@oracle.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.cz>
      cc: stable@vger.kernel.org # v3.7+
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      dd9ef135
    • Filipe Manana's avatar
      Btrfs: fix data loss in the fast fsync path · 3a8b36f3
      Filipe Manana authored
      
      
      When using the fast file fsync code path we can miss the fact that new
      writes happened since the last file fsync and therefore return without
      waiting for the IO to finish and write the new extents to the fsync log.
      
      Here's an example scenario where the fsync will miss the fact that new
      file data exists that wasn't yet durably persisted:
      
      1. fs_info->last_trans_committed == N - 1 and current transaction is
         transaction N (fs_info->generation == N);
      
      2. do a buffered write;
      
      3. fsync our inode, this clears our inode's full sync flag, starts
         an ordered extent and waits for it to complete - when it completes
         at btrfs_finish_ordered_io(), the inode's last_trans is set to the
         value N (via btrfs_update_inode_fallback -> btrfs_update_inode ->
         btrfs_set_inode_last_trans);
      
      4. transaction N is committed, so fs_info->last_trans_committed is now
         set to the value N and fs_info->generation remains with the value N;
      
      5. do another buffered write, when this happens btrfs_file_write_iter
         sets our inode's last_trans to the value N + 1 (that is
         fs_info->generation + 1 == N + 1);
      
      6. transaction N + 1 is started and fs_info->generation now has the
         value N + 1;
      
      7. transaction N + 1 is committed, so fs_info->last_trans_committed
         is set to the value N + 1;
      
      8. fsync our inode - because it doesn't have the full sync flag set,
         we only start the ordered extent, we don't wait for it to complete
         (only in a later phase) therefore its last_trans field has the
         value N + 1 set previously by btrfs_file_write_iter(), and so we
         have:
      
             inode->last_trans <= fs_info->last_trans_committed
                 (N + 1)              (N + 1)
      
         Which made us not log the last buffered write and exit the fsync
         handler immediately, returning success (0) to user space and resulting
         in data loss after a crash.
      
      This can actually be triggered deterministically and the following excerpt
      from a testcase I made for xfstests triggers the issue. It moves a dummy
      file across directories and then fsyncs the old parent directory - this
      is just to trigger a transaction commit, so moving files around isn't
      directly related to the issue but it was chosen because running 'sync' for
      example does more than just committing the current transaction, as it
      flushes/waits for all file data to be persisted. The issue can also happen
      at random periods, since the transaction kthread periodicaly commits the
      current transaction (about every 30 seconds by default).
      The body of the test is:
      
        _scratch_mkfs >> $seqres.full 2>&1
        _init_flakey
        _mount_flakey
      
        # Create our main test file 'foo', the one we check for data loss.
        # By doing an fsync against our file, it makes btrfs clear the 'needs_full_sync'
        # bit from its flags (btrfs inode specific flags).
        $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 8K" \
                        -c "fsync" $SCRATCH_MNT/foo | _filter_xfs_io
      
        # Now create one other file and 2 directories. We will move this second file
        # from one directory to the other later because it forces btrfs to commit its
        # currently open transaction if we fsync the old parent directory. This is
        # necessary to trigger the data loss bug that affected btrfs.
        mkdir $SCRATCH_MNT/testdir_1
        touch $SCRATCH_MNT/testdir_1/bar
        mkdir $SCRATCH_MNT/testdir_2
      
        # Make sure everything is durably persisted.
        sync
      
        # Write more 8Kb of data to our file.
        $XFS_IO_PROG -c "pwrite -S 0xbb 8K 8K" $SCRATCH_MNT/foo | _filter_xfs_io
      
        # Move our 'bar' file into a new directory.
        mv $SCRATCH_MNT/testdir_1/bar $SCRATCH_MNT/testdir_2/bar
      
        # Fsync our first directory. Because it had a file moved into some other
        # directory, this made btrfs commit the currently open transaction. This is
        # a condition necessary to trigger the data loss bug.
        $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir_1
      
        # Now fsync our main test file. If the fsync succeeds, we expect the 8Kb of
        # data we wrote previously to be persisted and available if a crash happens.
        # This did not happen with btrfs, because of the transaction commit that
        # happened when we fsynced the parent directory.
        $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
      
        # Simulate a crash/power loss.
        _load_flakey_table $FLAKEY_DROP_WRITES
        _unmount_flakey
      
        _load_flakey_table $FLAKEY_ALLOW_WRITES
        _mount_flakey
      
        # Now check that all data we wrote before are available.
        echo "File content after log replay:"
        od -t x1 $SCRATCH_MNT/foo
      
        status=0
        exit
      
      The expected golden output for the test, which is what we get with this
      fix applied (or when running against ext3/4 and xfs), is:
      
        wrote 8192/8192 bytes at offset 0
        XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
        wrote 8192/8192 bytes at offset 8192
        XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
        File content after log replay:
        0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
        *
        0020000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
        *
        0040000
      
      Without this fix applied, the output shows the test file does not have
      the second 8Kb extent that we successfully fsynced:
      
        wrote 8192/8192 bytes at offset 0
        XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
        wrote 8192/8192 bytes at offset 8192
        XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
        File content after log replay:
        0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
        *
        0020000
      
      So fix this by skipping the fsync only if we're doing a full sync and
      if the inode's last_trans is <= fs_info->last_trans_committed, or if
      the inode is already in the log. Also remove setting the inode's
      last_trans in btrfs_file_write_iter since it's useless/unreliable.
      
      Also because btrfs_file_write_iter no longer sets inode->last_trans to
      fs_info->generation + 1, don't set last_trans to 0 if we bail out and don't
      bail out if last_trans is 0, otherwise something as simple as the following
      example wouldn't log the second write on the last fsync:
      
        1. write to file
      
        2. fsync file
      
        3. fsync file
             |--> btrfs_inode_in_log() returns true and it set last_trans to 0
      
        4. write to file
             |--> btrfs_file_write_iter() no longers sets last_trans, so it
                  remained with a value of 0
        5. fsync
             |--> inode->last_trans == 0, so it bails out without logging the
                  second write
      
      A test case for xfstests will be sent soon.
      
      CC: <stable@vger.kernel.org>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      3a8b36f3
    • Josef Bacik's avatar
      Btrfs: remove extra run_delayed_refs in update_cowonly_root · f5c0a122
      Josef Bacik authored
      
      
      This got added with my dirty_bgs patch, it's not needed.  Thanks,
      
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      f5c0a122
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-domains' and 'pm-cpufreq' · e178e7d6
      Rafael J. Wysocki authored
      * pm-domains:
        PM / Domains: cleanup: rename gpd -> genpd in debugfs interface
      
      * pm-cpufreq:
        cpufreq: ppc: Add missing #include <asm/smp.h>
      e178e7d6
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-video' · 1e3e770c
      Rafael J. Wysocki authored
      * acpi-video:
        ACPI / video: Propagate the error code for acpi_video_register
        ACPI / video: Load the module even if ACPI is disabled
      1e3e770c
    • Rafael J. Wysocki's avatar
      Merge branch 'irq-pm' · 79d22364
      Rafael J. Wysocki authored
      * irq-pm:
        genirq / PM: describe IRQF_COND_SUSPEND
        tty: serial: atmel: rework interrupt and wakeup handling
        watchdog: at91sam9: request the irq with IRQF_NO_SUSPEND
        clk: at91: implement suspend/resume for the PMC irqchip
        rtc: at91rm9200: rework wakeup and interrupt handling
        rtc: at91sam9: rework wakeup and interrupt handling
        PM / wakeup: export pm_system_wakeup symbol
        genirq / PM: Add flag for shared NO_SUSPEND interrupt lines
        genirq / PM: better describe IRQF_NO_SUSPEND semantics
      79d22364
    • Mark Rutland's avatar
      genirq / PM: describe IRQF_COND_SUSPEND · 7438b633
      Mark Rutland authored
      With certain restrictions it is possible for a wakeup device to share
      an IRQ with an IRQF_NO_SUSPEND user, and the warnings introduced by
      commit cab303be
      
       are spurious. The new
      IRQF_COND_SUSPEND flag allows drivers to tell the core when these
      restrictions are met, allowing spurious warnings to be silenced.
      
      This patch documents how IRQF_COND_SUSPEND is expected to be used,
      updating some of the text now made invalid by its addition.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7438b633
    • Boris BREZILLON's avatar
      tty: serial: atmel: rework interrupt and wakeup handling · 2c7af5ba
      Boris BREZILLON authored
      
      
      The IRQ line connected to the DBGU UART is often shared with a timer device
      which request the IRQ with IRQF_NO_SUSPEND.
      
      Since the UART driver is correctly disabling IRQs when entering suspend
      we can safely request the IRQ with IRQF_COND_SUSPEND so that irq core
      will not complain about mixing IRQF_NO_SUSPEND and !IRQF_NO_SUSPEND.
      
      Rework the interrupt handler to wake the system up when an interrupt
      happens on the DEBUG_UART while the system is suspended.
      
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Reviewed-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2c7af5ba
    • Boris BREZILLON's avatar
      watchdog: at91sam9: request the irq with IRQF_NO_SUSPEND · d677772e
      Boris BREZILLON authored
      
      
      The watchdog interrupt (only used when activating software watchdog)
      shouldn't be suspended when entering suspend mode, because it is shared
      with a timer device (which request the line with IRQF_NO_SUSPEND) and once
      the watchdog "Mode Register" has been written, it cannot be changed (which
      means we cannot disable the watchdog interrupt when entering suspend).
      
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Reviewed-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d677772e
    • Rafael J. Wysocki's avatar
      Merge branch 'suspend-to-idle' · eef16e43
      Rafael J. Wysocki authored
      * suspend-to-idle:
        cpuidle / sleep: Use broadcast timer for states that stop local timer
        cpuidle: Clean up fallback handling in cpuidle_idle_call()
        cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze() too
        idle / sleep: Avoid excessive disabling and enabling interrupts
      eef16e43
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-resources' · 8204680c
      Rafael J. Wysocki authored
      * acpi-resources:
        x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around BIOS bugs
        x86/PCI/ACPI: Ignore resources consumed by host bridge itself
        PCI: versatile: Update for list_for_each_entry() API change
      8204680c
    • Rafael J. Wysocki's avatar
      cpuidle / sleep: Use broadcast timer for states that stop local timer · ef2b22ac
      Rafael J. Wysocki authored
      Commit 38106313 (PM / sleep: Re-implement suspend-to-idle handling)
      overlooked the fact that entering some sufficiently deep idle states
      by CPUs may cause their local timers to stop and in those cases it
      is necessary to switch over to a broadcast timer prior to entering
      the idle state.  If the cpuidle driver in use does not provide
      the new ->enter_freeze callback for any of the idle states, that
      problem affects suspend-to-idle too, but it is not taken into account
      after the changes made by commit 38106313.
      
      Fix that by changing the definition of cpuidle_enter_freeze() and
      re-arranging of the code in cpuidle_idle_call(), so the former does
      not call cpuidle_enter() any more and the fallback case is handled
      by cpuidle_idle_call() directly.
      
      Fixes: 38106313
      
       (PM / sleep: Re-implement suspend-to-idle handling)
      Reported-and-tested-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      ef2b22ac
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 99aedde0
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes: EFI fixes, an Intel Quark fix, an asm fix and an FPU
        handling fix"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/fpu/xsaves: Fix improper uses of __ex_table
        x86/intel/quark: Select COMMON_CLK
        x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
        firmware: dmi_scan: Fix dmi_len type
        efi/libstub: Fix boundary checking in efi_high_alloc()
        firmware: dmi_scan: Fix dmi scan to handle "End of Table" structure
      99aedde0