1. 30 Aug, 2019 8 commits
    • Deepa Dinamani's avatar
      ext4: Initialize timestamps limits · 4881c497
      Deepa Dinamani authored
      ext4 has different overflow limits for max filesystem
      timestamps based on the extra bytes available.
      
      The timestamp limits are calculated according to the
      encoding table in
      a4dad1aei(ext4: Fix handling of extended tv_sec):
      
      * extra  msb of                         adjust for signed
      * epoch  32-bit                         32-bit tv_sec to
      * bits   time    decoded 64-bit tv_sec  64-bit tv_sec      valid time range
      * 0 0    1    -0x80000000..-0x00000001  0x000000000   1901-12-13..1969-12-31
      * 0 0    0    0x000000000..0x07fffffff  0x000000000   1970-01-01..2038-01-19
      * 0 1    1    0x080000000..0x0ffffffff  0x100000000   2038-01-19..2106-02-07
      * 0 1    0    0x100000000..0x17fffffff  0x100000000   2106-02-07..2174-02-25
      * 1 0    1    0x180000000..0x1ffffffff  0x200000000   2174-02-25..2242-03-16
      * 1 0    0    0x200000000..0x27fffffff  0x200000000   2242-03-16..2310-04-04
      * 1 1    1    0x280000000..0x2ffffffff  0x300000000   2310-04-04..2378-04-22
      * 1 1    0    0x300000000..0x37fffffff  0x300000000   2378-04-22..2446-05-10
      
      Note that the time limits are not correct for deletion times.
      
      Added a warn when an inode cannot be extended to incorporate an
      extended timestamp.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: tytso@mit.edu
      Cc: adilger.kernel@dilger.ca
      Cc: linux-ext4@vger.kernel.org
      4881c497
    • Deepa Dinamani's avatar
      9p: Fill min and max timestamps in sb · d5c6e2d5
      Deepa Dinamani authored
      struct p9_wstat and struct p9_stat_dotl indicate that the
      wire transport uses u32 and u64 fields for timestamps.
      Fill in the appropriate limits to avoid inconsistencies in
      the vfs cached inode times when timestamps are outside the
      permitted range.
      
      Note that the upper bound for V9FS_PROTO_2000L is retained as S64_MAX.
      This is because that is the upper bound supported by vfs.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: ericvh@gmail.com
      Cc: lucho@ionkov.net
      Cc: asmadeus@codewreck.org
      Cc: v9fs-developer@lists.sourceforge.net
      d5c6e2d5
    • Deepa Dinamani's avatar
      fs: Fill in max and min timestamps in superblock · 22b13969
      Deepa Dinamani authored
      Fill in the appropriate limits to avoid inconsistencies
      in the vfs cached inode times when timestamps are
      outside the permitted range.
      
      Even though some filesystems are read-only, fill in the
      timestamps to reflect the on-disk representation.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Acked-By: default avatarTigran Aivazian <aivazian.tigran@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: aivazian.tigran@gmail.com
      Cc: al@alarsen.net
      Cc: coda@cs.cmu.edu
      Cc: darrick.wong@oracle.com
      Cc: dushistov@mail.ru
      Cc: dwmw2@infradead.org
      Cc: hch@infradead.org
      Cc: jack@suse.com
      Cc: jaharkes@cs.cmu.edu
      Cc: luisbg@kernel.org
      Cc: nico@fluxnic.net
      Cc: phillip@squashfs.org.uk
      Cc: richard@nod.at
      Cc: salah.triki@gmail.com
      Cc: shaggy@kernel.org
      Cc: linux-xfs@vger.kernel.org
      Cc: codalist@coda.cs.cmu.edu
      Cc: linux-ext4@vger.kernel.org
      Cc: linux-mtd@lists.infradead.org
      Cc: jfs-discussion@lists.sourceforge.net
      Cc: reiserfs-devel@vger.kernel.org
      22b13969
    • Deepa Dinamani's avatar
      utimes: Clamp the timestamps before update · 42e729b9
      Deepa Dinamani authored
      POSIX is ambiguous on the behavior of timestamps for
      futimens, utimensat and utimes. Whether to return an
      error or silently clamp a timestamp beyond the range
      supported by the underlying filesystems is not clear.
      
      POSIX.1 section for futimens, utimensat and utimes says:
      (http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html)
      
      The file's relevant timestamp shall be set to the greatest
      value supported by the file system that is not greater
      than the specified time.
      
      If the tv_nsec field of a timespec structure has the special
      value UTIME_NOW, the file's relevant timestamp shall be set
      to the greatest value supported by the file system that is
      not greater than the current time.
      
      [EINVAL]
          A new file timestamp would be a value whose tv_sec
          component is not a value supported by the file system.
      
      The patch chooses to clamp the timestamps according to the
      filesystem timestamp ranges and does not return an error.
      This is in line with the behavior of utime syscall also
      since the POSIX page(http://pubs.opengroup.org/onlinepubs/009695399/functions/utime.html)
      for utime does not mention returning an error or clamping like above.
      
      Same for utimes http://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.htmlSigned-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      42e729b9
    • Deepa Dinamani's avatar
      mount: Add mount warning for impending timestamp expiry · f8b92ba6
      Deepa Dinamani authored
      The warning reuses the uptime max of 30 years used by
      settimeofday().
      
      Note that the warning is only emitted for writable filesystem mounts
      through the mount syscall. Automounts do not have the same warning.
      
      Print out the warning in human readable format using the struct tm.
      After discussion with Arnd Bergmann, we chose to print only the year number.
      The raw s_time_max is also displayed, and the user can easily decode
      it e.g. "date -u -d @$((0x7fffffff))". We did not want to consolidate
      struct rtc_tm and struct tm just to print the date using a format specifier
      as part of this series.
      Given that the rtc_tm is not compiled on all architectures, this is not a
      trivial patch. This can be added in the future.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      f8b92ba6
    • Deepa Dinamani's avatar
      timestamp_truncate: Replace users of timespec64_trunc · 3818c190
      Deepa Dinamani authored
      Update the inode timestamp updates to use timestamp_truncate()
      instead of timespec64_trunc().
      
      The change was mostly generated by the following coccinelle
      script.
      
      virtual context
      virtual patch
      
      @r1 depends on patch forall@
      struct inode *inode;
      identifier i_xtime =~ "^i_[acm]time$";
      expression e;
      @@
      
      inode->i_xtime =
      - timespec64_trunc(
      + timestamp_truncate(
      ...,
      - e);
      + inode);
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: adrian.hunter@intel.com
      Cc: dedekind1@gmail.com
      Cc: gregkh@linuxfoundation.org
      Cc: hch@lst.de
      Cc: jaegeuk@kernel.org
      Cc: jlbec@evilplan.org
      Cc: richard@nod.at
      Cc: tj@kernel.org
      Cc: yuchao0@huawei.com
      Cc: linux-f2fs-devel@lists.sourceforge.net
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: linux-mtd@lists.infradead.org
      3818c190
    • Deepa Dinamani's avatar
      vfs: Add timestamp_truncate() api · 50e17c00
      Deepa Dinamani authored
      timespec_trunc() function is used to truncate a
      filesystem timestamp to the right granularity.
      But, the function does not clamp tv_sec part of the
      timestamps according to the filesystem timestamp limits.
      
      The replacement api: timestamp_truncate() also alters the
      signature of the function to accommodate filesystem
      timestamp clamping according to flesystem limits.
      
      Note that the tv_nsec part is set to 0 if tv_sec is not within
      the range supported for the filesystem.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      50e17c00
    • Deepa Dinamani's avatar
      vfs: Add file timestamp range support · 188d20bc
      Deepa Dinamani authored
      Add fields to the superblock to track the min and max
      timestamps supported by filesystems.
      
      Initially, when a superblock is allocated, initialize
      it to the max and min values the fields can hold.
      Individual filesystems override these to match their
      actual limits.
      
      Pseudo filesystems are assumed to always support the
      min and max allowable values for the fields.
      Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      188d20bc
  2. 25 Aug, 2019 22 commits
  3. 24 Aug, 2019 8 commits
  4. 23 Aug, 2019 2 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 9140d8bd
      Linus Torvalds authored
      Pull rdma fixes from Doug Ledford:
       "No beating around the bush: this is a monster pull request for an -rc5
        kernel. Intel hit me with a series of fixes for TID processing.
        Mellanox hit me with a series for their UMR memory support.
      
        And we had one fix for siw that fixes the 32bit build warnings and
        because of the number of casts that had to be changed to properly
        silence the warnings, that one patch alone is a full 40% of the LOC of
        this entire pull request. Given that this is the initial release
        kernel for siw, I'm trying to fix anything in it that we can, so that
        adds to the impetus to take fixes for it like this one.
      
        I had to do a rebase early in the week. Jason had thought he put a
        patch on the rc queue that he needed to be there so he could base some
        work off of it, and it had actually not been placed there. So he asked
        me (on Tuesday) to fix that up before pushing my wip branch to the
        official rc branch. I did, and that's why the early patches look like
        they were all committed at the same time on Tuesday. That bunch had
        been in my queue prior.
      
        The various patches all pass my test for being legitimate fixes and
        not attempts to slide new features or development into a late rc.
        Well, they were all fixes with the exception of a couple clean up
        patches people wrote for making the fixes they also wrote better (like
        a cleanup patch to move UMR checking into a function so that the
        remaining UMR fix patches can reference that function), so I left
        those in place too.
      
        My apologies for the LOC count and the number of patches here, it's
        just how the cards fell this cycle.
      
        Summary:
      
         - Fix siw buffer mapping issue
      
         - Fix siw 32/64 casting issues
      
         - Fix a KASAN access issue in bnxt_re
      
         - Fix several memory leaks (hfi1, mlx4)
      
         - Fix a NULL deref in cma_cleanup
      
         - Fixes for UMR memory support in mlx5 (4 patch series)
      
         - Fix namespace check for restrack
      
         - Fixes for counter support
      
         - Fixes for hfi1 TID processing (5 patch series)
      
         - Fix potential NULL deref in siw
      
         - Fix memory page calculations in mlx5"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (21 commits)
        RDMA/siw: Fix 64/32bit pointer inconsistency
        RDMA/siw: Fix SGL mapping issues
        RDMA/bnxt_re: Fix stack-out-of-bounds in bnxt_qplib_rcfw_send_message
        infiniband: hfi1: fix memory leaks
        infiniband: hfi1: fix a memory leak bug
        IB/mlx4: Fix memory leaks
        RDMA/cma: fix null-ptr-deref Read in cma_cleanup
        IB/mlx5: Block MR WR if UMR is not possible
        IB/mlx5: Fix MR re-registration flow to use UMR properly
        IB/mlx5: Report and handle ODP support properly
        IB/mlx5: Consolidate use_umr checks into single function
        RDMA/restrack: Rewrite PID namespace check to be reliable
        RDMA/counters: Properly implement PID checks
        IB/core: Fix NULL pointer dereference when bind QP to counter
        IB/hfi1: Drop stale TID RDMA packets that cause TIDErr
        IB/hfi1: Add additional checks when handling TID RDMA WRITE DATA packet
        IB/hfi1: Add additional checks when handling TID RDMA READ RESP packet
        IB/hfi1: Unsafe PSN checking for TID RDMA READ Resp packet
        IB/hfi1: Drop stale TID RDMA packets
        RDMA/siw: Fix potential NULL de-ref
        ...
      9140d8bd
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190823' of git://git.kernel.dk/linux-block · b9bd6806
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Here's a set of fixes that should go into this release. This contains:
      
         - Three minor fixes for NVMe.
      
         - Three minor tweaks for the io_uring polling logic.
      
         - Officially mark Song as the MD maintainer, after he's been filling
           that role sucessfully for the last 6 months or so"
      
      * tag 'for-linus-20190823' of git://git.kernel.dk/linux-block:
        io_uring: add need_resched() check in inner poll loop
        md: update MAINTAINERS info
        io_uring: don't enter poll loop if we have CQEs pending
        nvme: Add quirk for LiteON CL1 devices running FW 22301111
        nvme: Fix cntlid validation when not using NVMEoF
        nvme-multipath: fix possible I/O hang when paths are updated
        io_uring: fix potential hang with polled IO
      b9bd6806