1. Mar 15, 2011
    • Rafael J. Wysocki's avatar
      PM: Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME) · 1eb208ae
      Rafael J. Wysocki authored
      
      
      From the users' point of view CONFIG_PM is really only used for
      making it possible to set CONFIG_SUSPEND, CONFIG_HIBERNATION,
      CONFIG_PM_RUNTIME and (surprisingly enough) CONFIG_XEN_SAVE_RESTORE
      (CONFIG_PM_OPP also depends on CONFIG_PM, but quite artificially).
      However, both CONFIG_SUSPEND and CONFIG_HIBERNATION require platform
      support (independent of CONFIG_PM) and it is not quite obvious that
      CONFIG_PM has to be set for CONFIG_XEN_SAVE_RESTORE to be available.
      Thus, from the users' point of view, it would be more logical to
      automatically select CONFIG_PM if any of the above options depending
      on it are set.
      
      Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME),
      which will cause it to be selected when any of CONFIG_SUSPEND,
      CONFIG_HIBERNATION, CONFIG_PM_RUNTIME, CONFIG_XEN_SAVE_RESTORE is
      set and will clarify its meaning.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      1eb208ae
    • Rafael J. Wysocki's avatar
      PM / ACPI: Remove references to pm_flags from bus.c · cd51e61c
      Rafael J. Wysocki authored
      
      
      If direct references to pm_flags are removed from drivers/acpi/bus.c,
      CONFIG_ACPI will not need to depend on CONFIG_PM any more.  Make that
      happen.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarLen Brown <len.brown@intel.com>
      cd51e61c
    • Rafael J. Wysocki's avatar
      PM: Do not create wakeup sysfs files for devices that cannot wake up · cb8f51bd
      Rafael J. Wysocki authored
      
      
      Currently, wakeup sysfs attributes are created for all devices,
      regardless of whether or not they are wakeup-capable.  This is
      excessive and complicates wakeup device identification from user
      space (i.e. to identify wakeup-capable devices user space has to read
      /sys/devices/.../power/wakeup for all devices and see if they are not
      empty).
      
      Fix this issue by avoiding to create wakeup sysfs files for devices
      that cannot wake up the system from sleep states (i.e. whose
      power.can_wakeup flags are unset during registration) and modify
      device_set_wakeup_capable() so that it adds (or removes) the relevant
      sysfs attributes if a device's wakeup capability status is changed.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      cb8f51bd
    • Rafael J. Wysocki's avatar
      USB / Hub: Do not call device_set_wakeup_capable() under spinlock · 4681b171
      Rafael J. Wysocki authored
      
      
      A subsequent patch will modify device_set_wakeup_capable() in such
      a way that it will call functions which may sleep and therefore it
      shouldn't be called under spinlocks.  In preparation to that, modify
      usb_set_device_state() to avoid calling device_set_wakeup_capable()
      under device_state_lock.
      
      Tested-by: default avatarMinchan Kim <minchan.kim@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4681b171
    • Mandeep Singh Baines's avatar
      PM: Use appropriate printk() priority level in trace.c · 0295a34d
      Mandeep Singh Baines authored
      
      
      printk()s without a priority level default to KERN_WARNING. To reduce
      noise at KERN_WARNING, this patch sets the priority level appriopriately
      for unleveled printks()s. This should be useful to folks that look at
      dmesg warnings closely.
      
      Changed these messages to pr_info().
      
      Signed-off-by: default avatarMandeep Singh Baines <msb@chromium.org>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      0295a34d
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Don't update events_check_enabled in pm_get_wakeup_count() · 790c7885
      Rafael J. Wysocki authored
      
      
      Since pm_save_wakeup_count() has just been changed to clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the last read from
      /sys/power/wakeup_count, the detection of wakeup events during
      suspend may be disabled, after it's been enabled, by writing a
      "wrong" value back to /sys/power/wakeup_count.  For this reason,
      it is not necessary to update events_check_enabled in
      pm_get_wakeup_count() any more.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      790c7885
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Make pm_save_wakeup_count() work as documented · 378eef99
      Rafael J. Wysocki authored
      
      
      According to Documentation/ABI/testing/sysfs-power, the
      /sys/power/wakeup_count interface should only make the kernel react
      to wakeup events during suspend if the last write to it has been
      successful.  However, if /sys/power/wakeup_count is written to two
      times in a row, where the first write is successful and the second
      is not, the kernel will still react to wakeup events during suspend
      due to a bug in pm_save_wakeup_count().
      
      Fix the bug by making pm_save_wakeup_count() clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the previous read from
      /sys/power/wakeup_count.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      378eef99
    • Rafael J. Wysocki's avatar
      PM / Wakeup: Combine atomic counters to avoid reordering issues · 023d3779
      Rafael J. Wysocki authored
      
      
      The memory barrier in wakeup_source_deactivate() is supposed to
      prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
      from seeing the new value of events_in_progress (0, in particular)
      and the old value of event_count at the same time.  However, if
      wakeup_source_deactivate() is executed by CPU0 and, for instance,
      pm_wakeup_pending() is executed by CPU1, where both processors can
      reorder operations, the memory barrier in wakeup_source_deactivate()
      doesn't affect CPU1 which can reorder reads.  In that case CPU1 may
      very well decide to fetch event_count before it's modified and
      events_in_progress after it's been updated, so pm_wakeup_pending()
      may fail to detect a wakeup event.  This issue can be addressed by
      using a single atomic variable to store both events_in_progress
      and event_count, so that they can be updated together in a single
      atomic operation.
      
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      023d3779
    • Oleg Nesterov's avatar
      oom: oom_kill_process: fix the child_points logic · dc1b83ab
      Oleg Nesterov authored
      
      
      oom_kill_process() starts with victim_points == 0.  This means that
      (most likely) any child has more points and can be killed erroneously.
      
      Also, "children has a different mm" doesn't match the reality, we should
      check child->mm != t->mm.  This check is not exactly correct if t->mm ==
      NULL but this doesn't really matter, oom_kill_task() will kill them
      anyway.
      
      Note: "Kill all processes sharing p->mm" in oom_kill_task() is wrong
      too.
      
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc1b83ab
    • Linus Torvalds's avatar
      Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 · 5f40d420
      Linus Torvalds authored
      * 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
        NFS: NFSROOT should default to "proto=udp"
        nfs4: remove duplicated #include
        NFSv4: nfs4_state_mark_reclaim_nograce() should be static
        NFSv4: Fix the setlk error handler
        NFSv4.1: Fix the handling of the SEQUENCE status bits
        NFSv4/4.1: Fix nfs4_schedule_state_recovery abuses
        NFSv4.1 reclaim complete must wait for completion
        NFSv4: remove duplicate clientid in struct nfs_client
        NFSv4.1: Retry CREATE_SESSION on NFS4ERR_DELAY
        sunrpc: Propagate errors from xs_bind() through xs_create_sock()
        (try3-resend) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in fileid
        nfs: fix compilation warning
        nfs: add kmalloc return value check in decode_and_add_ds
        SUNRPC: Remove resource leak in svc_rdma_send_error()
        nfs: close NFSv4 COMMIT vs. CLOSE race
        SUNRPC: Close a race in __rpc_wait_for_completion_task()
      5f40d420
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 · 215fd2fa
      Linus Torvalds authored
      * 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
        drm/radeon: fix problem with changing active VRAM size. (v2)
      215fd2fa
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog · 786c58b7
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
        watchdog: hpwdt: eliminate section mismatch warning
        watchdog: w83697ug_wdt: Fix set bit 0 to activate GPIO2
        watchdog: sch311x_wdt: fix printk condition
        watchdog: sch311x_wdt: Fix LDN active check
        watchdog: cpwd: Fix buffer-overflow
      786c58b7
    • Timo Warns's avatar
      Fix corrupted OSF partition table parsing · 1eafbfeb
      Timo Warns authored
      
      
      The kernel automatically evaluates partition tables of storage devices.
      The code for evaluating OSF partitions contains a bug that leaks data
      from kernel heap memory to userspace for certain corrupted OSF
      partitions.
      
      In more detail:
      
        for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
      
      iterates from 0 to d_npartitions - 1, where d_npartitions is read from
      the partition table without validation and partition is a pointer to an
      array of at most 8 d_partitions.
      
      Add the proper and obvious validation.
      
      Signed-off-by: default avatarTimo Warns <warns@pre-sense.de>
      Cc: stable@kernel.org
      [ Changed the patch trivially to not repeat the whole le16_to_cpu()
        thing, and to use an explicit constant for the magic value '8' ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1eafbfeb
  2. Mar 14, 2011
  3. Mar 13, 2011
  4. Mar 12, 2011
    • Chris Mason's avatar
      Btrfs: break out of shrink_delalloc earlier · 36e39c40
      Chris Mason authored
      
      
      Josef had changed shrink_delalloc to exit after three shrink
      attempts, which wasn't quite enough because new writers could
      race in and steal free space.
      
      But it also fixed deadlocks and stalls as we tried to recover
      delalloc reservations.  The code was tweaked to loop 1024
      times, and would reset the counter any time a small amount
      of progress was made.  This was too drastic, and with a
      lot of writers we can end up stuck in shrink_delalloc forever.
      
      The shrink_delalloc loop is fairly complex because the caller is looping
      too, and the caller will go ahead and force a transaction commit to make
      sure we reclaim space.
      
      This reworks things to exit shrink_delalloc when we've forced some
      writeback and the delalloc reservations have gone down.  This means
      the writeback has not just started but has also finished at
      least some of the metadata changes required to reclaim delalloc
      space.
      
      If we've got this wrong, we're returning ENOSPC too early, which
      is a big improvement over the current behavior of hanging the machine.
      
      Test 224 in xfstests hammers on this nicely, and with 1000 writers
      trying to fill a 1GB drive we get our first ENOSPC at 93% full.  The
      other writers are able to continue until we get 100%.
      
      This is a worst case test for btrfs because the 1000 writers are doing
      small IO, and the small FS size means we don't have a lot of room
      for metadata chunks.
      
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      36e39c40
    • Chuck Lever's avatar
      NFS: NFSROOT should default to "proto=udp" · 53d47375
      Chuck Lever authored
      There have been a number of recent reports that NFSROOT is no longer
      working with default mount options, but fails only with certain NICs.
      
      Brian Downing <bdowning@lavos.net> bisected to commit 56463e50 "NFS:
      Use super.c for NFSROOT mount option parsing".  Among other things,
      this commit changes the default mount options for NFSROOT to use TCP
      instead of UDP as the underlying transport.
      
      TCP seems less able to deal with NICs that are slow to initialize.
      The system logs that have accompanied reports of problems all show
      that NFSROOT attempts to establish a TCP connection before the NIC is
      fully initialized, and thus the TCP connection attempt fails.
      
      When a TCP connection attempt fails during a mount operation, the
      NFS stack needs to fail the operation.  Usually user space knows how
      and when to retry it.  The network layer does not report a distinct
      error code for this particular failure mode.  Thus, there isn't a
      clean way for the RPC client to see that it needs to retry in this
      case, but not in others.
      
      Because NFSROOT is used in some environments where it is not possible
      to update the kernel command line to specify "udp", the proper thing
      to do is change NFSROOT to use UDP by default, as it did before commit
      56463e50
      
      .
      
      To make it easier to see how to change default mount options for
      NFSROOT and to distinguish default settings from mandatory settings,
      I've adjusted a couple of areas to document the specifics.
      
      root_nfs_cat() is also modified to deal with commas properly when
      concatenating strings containing mount option lists.  This keeps
      root_nfs_cat() call sites simpler, now that we may be concatenating
      multiple mount option strings.
      
      Tested-by: default avatarBrian Downing <bdowning@lavos.net>
      Tested-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Cc: <stable@kernel.org> # 2.6.37
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      53d47375
    • Huang Weiyi's avatar
      nfs4: remove duplicated #include · 57df216b
      Huang Weiyi authored
      
      
      Remove duplicated #include('s) in
        fs/nfs/nfs4proc.c
      
      Signed-off-by: default avatarHuang Weiyi <weiyi.huang@gmail.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      57df216b
    • Trond Myklebust's avatar
      NFSv4: nfs4_state_mark_reclaim_nograce() should be static · f9feab1e
      Trond Myklebust authored
      
      
      There are no more external users of nfs4_state_mark_reclaim_nograce() or
      nfs4_state_mark_reclaim_reboot(), so mark them as static.
      
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      f9feab1e
    • Trond Myklebust's avatar
      ecac799a
    • Trond Myklebust's avatar
      NFSv4.1: Fix the handling of the SEQUENCE status bits · b4410c2f
      Trond Myklebust authored
      
      
      We want SEQUENCE status bits to be handled by the state manager in order
      to avoid threading issues.
      
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      b4410c2f