1. 17 Aug, 2015 2 commits
    • Karsten Blees's avatar
      time: Fix nanosecond file time rounding in timespec_trunc() · de4a95fa
      Karsten Blees authored
      timespec_trunc() avoids rounding if granularity <= nanoseconds-per-jiffie
      (or TICK_NSEC). This optimization assumes that:
      
       1. current_kernel_time().tv_nsec is already rounded to TICK_NSEC (i.e.
          with HZ=1000 you'd get 1000000, 2000000, 3000000... but never 1000001).
          This is no longer true (probably since hrtimers introduced in 2.6.16).
      
       2. TICK_NSEC is evenly divisible by all possible granularities. This may
          be true for HZ=100, 250, 1000, but obviously not for HZ=300 /
          TICK_NSEC=3333333 (introduced in 2.6.20).
      
      Thus, sub-second portions of in-core file times are not rounded to on-disk
      granularity. I.e. file times may change when the inode is re-read from disk
      or when the file system is remounted.
      
      This affects all file systems with file time granularities > 1 ns and < 1s,
      e.g. CEPH (1000 ns), UDF (1000 ns), CIFS (100 ns), NTFS (100 ns) and FUSE
      (configurable from user mode via struct fuse_init_out.time_gran).
      
      Steps to reproduce with e.g. UDF:
      
        $ dd if=/dev/zero of=udfdisk count=10000 && mkudffs udfdisk
        $ mkdir udf && mount udfdisk udf
        $ touch udf/test && stat -c %y udf/test
        2015-06-09 10:22:56.130006767 +0200
        $ umount udf && mount udfdisk udf
        $ stat -c %y udf/test
        2015-06-09 10:22:56.130006000 +0200
      
      Remounting truncates the mtime to 1 µs.
      
      Fix the rounding in timespec_trunc() and update the documentation.
      
      timespec_trunc() is exclusively used to calculate inode's [acm]time (mostly
      via current_fs_time()), and always with super_block.s_time_gran as second
      argument. So this can safely be changed without side effects.
      
      Note: This does _not_ fix the issue for FAT's 2 second mtime resolution,
      as super_block.s_time_gran isn't prepared to handle different ctime /
      mtime / atime resolutions nor resolutions > 1 second.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarKarsten Blees <blees@dcon.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      de4a95fa
    • John Stultz's avatar
      timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers · 38bf985b
      John Stultz authored
      I noticed for non-monotonic timers in timer_list, some of the
      output looked a little confusing.
      
      For example:
       #1: <0000000000000000>, posix_timer_fn, S:01, hrtimer_start_range_ns, leap-a-day/2360
       # expires at 1434412800000000000-1434412800000000000 nsecs [in 1434410725062375469 to 1434410725062375469 nsecs]
      
      You'll note the relative time till the expiration "[in xxx to
      yyy nsecs]" is incorrect. This is because its printing the delta
      between CLOCK_MONOTONIC time to the CLOCK_REALTIME expiration.
      
      This patch fixes this issue by adding the clock offset to the
      "now" time which we use to calculate the delta.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jiri Bohac <jbohac@suse.cz>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      38bf985b
  2. 05 Jul, 2015 4 commits
    • Linus Torvalds's avatar
      Linux 4.2-rc1 · d770e558
      Linus Torvalds authored
      d770e558
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.2-2' of... · a585d2b7
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v4.2-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
      
      Pull late x86 platform driver updates from Darren Hart:
       "The following came in a bit later and I wanted them to bake in next a
        few more days before submitting, thus the second pull.
      
        A new intel_pmc_ipc driver, a symmetrical allocation and free fix in
        dell-laptop, a couple minor fixes, and some updated documentation in
        the dell-laptop comments.
      
        intel_pmc_ipc:
         - Add Intel Apollo Lake PMC IPC driver
      
        tc1100-wmi:
         - Delete an unnecessary check before the function call "kfree"
      
        dell-laptop:
         - Fix allocating & freeing SMI buffer page
         - Show info about WiGig and UWB in debugfs
         - Update information about wireless control"
      
      * tag 'platform-drivers-x86-v4.2-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
        intel_pmc_ipc: Add Intel Apollo Lake PMC IPC driver
        tc1100-wmi: Delete an unnecessary check before the function call "kfree"
        dell-laptop: Fix allocating & freeing SMI buffer page
        dell-laptop: Show info about WiGig and UWB in debugfs
        dell-laptop: Update information about wireless control
      a585d2b7
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 1dc51b82
      Linus Torvalds authored
      Pull more vfs updates from Al Viro:
       "Assorted VFS fixes and related cleanups (IMO the most interesting in
        that part are f_path-related things and Eric's descriptor-related
        stuff).  UFS regression fixes (it got broken last cycle).  9P fixes.
        fs-cache series, DAX patches, Jan's file_remove_suid() work"
      
      [ I'd say this is much more than "fixes and related cleanups".  The
        file_table locking rule change by Eric Dumazet is a rather big and
        fundamental update even if the patch isn't huge.   - Linus ]
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits)
        9p: cope with bogus responses from server in p9_client_{read,write}
        p9_client_write(): avoid double p9_free_req()
        9p: forgetting to cancel request on interrupted zero-copy RPC
        dax: bdev_direct_access() may sleep
        block: Add support for DAX reads/writes to block devices
        dax: Use copy_from_iter_nocache
        dax: Add block size note to documentation
        fs/file.c: __fget() and dup2() atomicity rules
        fs/file.c: don't acquire files->file_lock in fd_install()
        fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation
        vfs: avoid creation of inode number 0 in get_next_ino
        namei: make set_root_rcu() return void
        make simple_positive() public
        ufs: use dir_pages instead of ufs_dir_pages()
        pagemap.h: move dir_pages() over there
        remove the pointless include of lglock.h
        fs: cleanup slight list_entry abuse
        xfs: Correctly lock inode when removing suid and file capabilities
        fs: Call security_ops->inode_killpriv on truncate
        fs: Provide function telling whether file_remove_privs() will do anything
        ...
      1dc51b82
    • Linus Torvalds's avatar
      bluetooth: fix list handling · 9b284cbd
      Linus Torvalds authored
      Commit 835a6a2f ("Bluetooth: Stop sabotaging list poisoning")
      thought that the code was sabotaging the list poisoning when NULL'ing
      out the list pointers and removed it.
      
      But what was going on was that the bluetooth code was using NULL
      pointers for the list as a way to mark it empty, and that commit just
      broke it (and replaced the test with NULL with a "list_empty()" test on
      a uninitialized list instead, breaking things even further).
      
      So fix it all up to use the regular and real list_empty() handling
      (which does not use NULL, but a pointer to itself), also making sure to
      initialize the list properly (the previous NULL case was initialized
      implicitly by the session being allocated with kzalloc())
      
      This is a combination of patches by Marcel Holtmann and Tedd Ho-Jeong
      An.
      
      [ I would normally expect to get this through the bt tree, but I'm going
        to release -rc1, so I'm just committing this directly   - Linus ]
      Reported-and-tested-by: default avatarJörg Otte <jrg.otte@gmail.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Original-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
      Original-by: Marcel Holtmann <marcel@holtmann.org>:
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9b284cbd
  3. 04 Jul, 2015 34 commits