Skip to content
  1. May 18, 2017
  2. May 17, 2017
    • Linus Torvalds's avatar
      Merge tag 'pstore-v4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · b23afd38
      Linus Torvalds authored
      Pull pstore fix from Kees Cook:
       "Fix bad EFI vars iterator usage"
      
      * tag 'pstore-v4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        efi-pstore: Fix read iter after pstore API refactor
      b23afd38
    • Kees Cook's avatar
      efi-pstore: Fix read iter after pstore API refactor · 6f61dd3a
      Kees Cook authored
      During the internal pstore API refactoring, the EFI vars read entry was
      accidentally made to update a stack variable instead of the pstore
      private data pointer. This corrects the problem (and removes the now
      needless argument).
      
      Fixes: 125cc42b
      
       ("pstore: Replace arguments for read() API")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      6f61dd3a
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 2b6b38b0
      Linus Torvalds authored
      Pull s390 fixes from Martin Schwidefsky:
      
       - convert the debug feature to refcount_t
      
       - reduce the copy size for strncpy_from_user
      
       - 8 bug fixes
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/virtio: change virtio_feature_desc:features type to __le32
        s390: convert debug_info.ref_count from atomic_t to refcount_t
        s390: move _text symbol to address higher than zero
        s390/qdio: increase string buffer size
        s390/ccwgroup: increase string buffer size
        s390/topology: let topology_mnest_limit() return unsigned char
        s390/uaccess: use sane length for __strncpy_from_user()
        s390/uprobes: fix compile for !KPROBES
        s390/ftrace: fix compile for !MODULES
        s390/cputime: fix incorrect system time
      2b6b38b0
    • Linus Torvalds's avatar
      Merge tag 'edac_fix_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp · bec6cd63
      Linus Torvalds authored
      Pull EDAC fix from Borislav Petkov:
       "A single amd64_edac fix correcting chip select sizes reporting on
        F17h"
      
      * tag 'edac_fix_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp:
        EDAC, amd64: Fix reporting of Chip Select sizes on Fam17h
      bec6cd63
  3. May 16, 2017
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · a95cfad9
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Track alignment in BPF verifier so that legitimate programs won't be
          rejected on !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS architectures.
      
       2) Make tail calls work properly in arm64 BPF JIT, from Deniel
          Borkmann.
      
       3) Make the configuration and semantics Generic XDP make more sense and
          don't allow both generic XDP and a driver specific instance to be
          active at the same time. Also from Daniel.
      
       4) Don't crash on resume in xen-netfront, from Vitaly Kuznetsov.
      
       5) Fix use-after-free in VRF driver, from Gao Feng.
      
       6) Use netdev_alloc_skb_ip_align() to avoid unaligned IP headers in
          qca_spi driver, from Stefan Wahren.
      
       7) Always run cleanup routines in BPF samples when we get SIGTERM, from
          Andy Gospodarek.
      
       8) The mdio phy code should bring PHYs out of reset using the shared
          GPIO lines before invoking bus->reset(). From Florian Fainelli.
      
       9) Some USB descriptor access endian fixes in various drivers from
          Johan Hovold.
      
      10) Handle PAUSE advertisements properly in mlx5 driver, from Gal
          Pressman.
      
      11) Fix reversed test in mlx5e_setup_tc(), from Saeed Mahameed.
      
      12) Cure netdev leak in AF_PACKET when using timestamping via control
          messages. From Douglas Caetano dos Santos.
      
      13) netcp doesn't support HWTSTAMP_FILTER_ALl, reject it. From Miroslav
          Lichvar.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (52 commits)
        ldmvsw: stop the clean timer at beginning of remove
        ldmvsw: unregistering netdev before disable hardware
        net: netcp: fix check of requested timestamping filter
        ipv6: avoid dad-failures for addresses with NODAD
        qed: Fix uninitialized data in aRFS infrastructure
        mdio: mux: fix device_node_continue.cocci warnings
        net/packet: fix missing net_device reference release
        net/mlx4_core: Use min3 to select number of MSI-X vectors
        macvlan: Fix performance issues with vlan tagged packets
        net: stmmac: use correct pointer when printing normal descriptor ring
        net/mlx5: Use underlay QPN from the root name space
        net/mlx5e: IPoIB, Only support regular RQ for now
        net/mlx5e: Fix setup TC ndo
        net/mlx5e: Fix ethtool pause support and advertise reporting
        net/mlx5e: Use the correct pause values for ethtool advertising
        vmxnet3: ensure that adapter is in proper state during force_close
        sfc: revert changes to NIC revision numbers
        net: ch9200: add missing USB-descriptor endianness conversions
        net: irda: irda-usb: fix firmware name on big-endian hosts
        net: dsa: mv88e6xxx: add default case to switch
        ...
      a95cfad9
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 · 1319a285
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "A set of minor cifs fixes"
      
      * 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
        [CIFS] Minor cleanup of xattr query function
        fs: cifs: transport: Use time_after for time comparison
        SMB2: Fix share type handling
        cifs: cifsacl: Use a temporary ops variable to reduce code length
        Don't delay freeing mids when blocked on slow socket write of request
        CIFS: silence lockdep splat in cifs_relock_file()
      1319a285
    • David S. Miller's avatar
      Merge branch 'ldmsw-fixes' · 66f4bc81
      David S. Miller authored
      
      
      Shannon Nelson says:
      
      ====================
      ldmvsw: port removal stability
      
      Under heavy reboot stress testing we found a couple of timing issues
      when removing the device that could cause the kernel great heartburn,
      addressed by these two patches.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66f4bc81
    • Shannon Nelson's avatar
      ldmvsw: stop the clean timer at beginning of remove · 8b671f90
      Shannon Nelson authored
      
      
      Stop the clean timer earlier to be sure there's no asynchronous
      interference while stopping the port.
      
      Orabug: 25748241
      
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b671f90
    • Thomas Tai's avatar
      ldmvsw: unregistering netdev before disable hardware · b18e5e86
      Thomas Tai authored
      
      
      When running LDom binding/unbinding test, kernel may panic
      in ldmvsw_open(). It is more likely that because we're removing
      the ldc connection before unregistering the netdev in vsw_port_remove(),
      we set up a window of time where one process could be removing the
      device while another trying to UP the device. This also sometimes causes
      vio handshake error due to opening a device without closing it completely.
      We should unregister the netdev before we disable the "hardware".
      
      Orabug: 25980913, 25925306
      
      Signed-off-by: default avatarThomas Tai <thomas.tai@oracle.com>
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b18e5e86
    • Miroslav Lichvar's avatar
      net: netcp: fix check of requested timestamping filter · ca9df7ed
      Miroslav Lichvar authored
      
      
      The driver doesn't support timestamping of all received packets and
      should return error when trying to enable the HWTSTAMP_FILTER_ALL
      filter.
      
      Cc: WingMan Kwok <w-kwok2@ti.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca9df7ed
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2017-05-12-V2' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 42a928ce
      David S. Miller authored
      
      
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 fixes 2017-05-12
      
      This series contains some mlx5 fixes for net.
      Please pull and let me know if there's any problem.
      
      For -stable:
      ("net/mlx5e: Fix ethtool pause support and advertise reporting") kernels >= 4.8
      ("net/mlx5e: Use the correct pause values for ethtool advertising") kernels >= 4.8
      
      v1->v2:
       Dropped statistics spinlock patch, it needs some extra work.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42a928ce
    • Mahesh Bandewar's avatar
      ipv6: avoid dad-failures for addresses with NODAD · 66eb9f86
      Mahesh Bandewar authored
      
      
      Every address gets added with TENTATIVE flag even for the addresses with
      IFA_F_NODAD flag and dad-work is scheduled for them. During this DAD process
      we realize it's an address with NODAD and complete the process without
      sending any probe. However the TENTATIVE flags stays on the
      address for sometime enough to cause misinterpretation when we receive a NS.
      While processing NS, if the address has TENTATIVE flag, we mark it DADFAILED
      and endup with an address that was originally configured as NODAD with
      DADFAILED.
      
      We can't avoid scheduling dad_work for addresses with NODAD but we can
      avoid adding TENTATIVE flag to avoid this racy situation.
      
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66eb9f86
    • Mintz, Yuval's avatar
      qed: Fix uninitialized data in aRFS infrastructure · aa4ad88c
      Mintz, Yuval authored
      Current memset is using incorrect type of variable, causing the
      upper-half of the strucutre to be left uninitialized and causing:
      
        ethernet/qlogic/qed/qed_init_fw_funcs.c: In function 'qed_set_rfs_mode_disable':
        ethernet/qlogic/qed/qed_init_fw_funcs.c:993:3: error: '*((void *)&ramline+4)' is used uninitialized in this function [-Werror=uninitialized]
      
      Fixes: d51e4af5
      
       ("qed: aRFS infrastructure support")
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa4ad88c
    • Julia Lawall's avatar
      mdio: mux: fix device_node_continue.cocci warnings · 8c977f5a
      Julia Lawall authored
      
      
      Device node iterators put the previous value of the index variable, so an
      explicit put causes a double put.
      
      In particular, of_mdiobus_register can fail before doing anything
      interesting, so one could view it as a no-op from the reference count
      point of view.
      
      Generated by: scripts/coccinelle/iterators/device_node_continue.cocci
      
      CC: Jon Mason <jon.mason@broadcom.com>
      Signed-off-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c977f5a
    • Douglas Caetano dos Santos's avatar
      net/packet: fix missing net_device reference release · d19b183c
      Douglas Caetano dos Santos authored
      When using a TX ring buffer, if an error occurs processing a control
      message (e.g. invalid message), the net_device reference is not
      released.
      
      Fixes c14ac945
      
       ("sock: enable timestamping using control messages")
      Signed-off-by: default avatarDouglas Caetano dos Santos <douglascs@taghos.com.br>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d19b183c
    • yuval.shaia@oracle.com's avatar
    • Vlad Yasevich's avatar
      macvlan: Fix performance issues with vlan tagged packets · 70957eae
      Vlad Yasevich authored
      
      
      Macvlan always turns on offload features that have sofware
      fallback (NETIF_GSO_SOFTWARE).  This allows much higher guest-guest
      communications over macvtap.
      
      However, macvtap does not turn on these features for vlan tagged traffic.
      As a result, depending on the HW that mactap is configured on, the
      performance of guest-guest communication over a vlan is very
      inconsistent.  If the HW supports TSO/UFO over vlans, then the
      performance will be fine.  If not, the the performance will suffer
      greatly since the VM may continue using TSO/UFO, and will force the host
      segment the traffic and possibly overlow the macvtap queue.
      
      This patch adds the always on offloads to vlan_features.  This
      makes sure that any vlan tagged traffic between 2 guest will not
      be segmented needlessly.
      
      Signed-off-by: default avatarVladislav Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      70957eae
  4. May 15, 2017
  5. May 14, 2017
  6. May 13, 2017
    • Steve French's avatar
      [CIFS] Minor cleanup of xattr query function · 67b4c889
      Steve French authored
      
      
      Some minor cleanup of cifs query xattr functions (will also make
      SMB3 xattr implementation cleaner as well).
      
      Signed-off-by: default avatarSteve French <steve.french@primarydata.com>
      67b4c889
    • Karim Eshapa's avatar
      fs: cifs: transport: Use time_after for time comparison · 4328fea7
      Karim Eshapa authored
      
      
      Use time_after kernel macro for time comparison
      that has safety check.
      
      Signed-off-by: default avatarKarim Eshapa <karim.eshapa@gmail.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      4328fea7
    • Christophe JAILLET's avatar
      SMB2: Fix share type handling · cd123007
      Christophe JAILLET authored
      In fs/cifs/smb2pdu.h, we have:
      #define SMB2_SHARE_TYPE_DISK    0x01
      #define SMB2_SHARE_TYPE_PIPE    0x02
      #define SMB2_SHARE_TYPE_PRINT   0x03
      
      Knowing that, with the current code, the SMB2_SHARE_TYPE_PRINT case can
      never trigger and printer share would be interpreted as disk share.
      
      So, test the ShareType value for equality instead.
      
      Fixes: faaf946a
      
       ("CIFS: Add tree connect/disconnect capability for SMB2")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      cd123007
    • Joe Perches via samba-technical's avatar
      cifs: cifsacl: Use a temporary ops variable to reduce code length · ecdcf622
      Joe Perches via samba-technical authored
      
      
      Create an ops variable to store tcon->ses->server->ops and cache
      indirections and reduce code size a trivial bit.
      
      $ size fs/cifs/cifsacl.o*
         text	   data	    bss	    dec	    hex	filename
         5338	    136	      8	   5482	   156a	fs/cifs/cifsacl.o.new
         5371	    136	      8	   5515	   158b	fs/cifs/cifsacl.o.old
      
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Acked-by: default avatarShirish Pargaonkar <shirishpargaonkar@gmail.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      ecdcf622
    • Roman Gushchin's avatar
      mm, docs: update memory.stat description with workingset* entries · b340959e
      Roman Gushchin authored
      
      
      Commit 4b4cea91691d ("mm: vmscan: fix IO/refault regression in cache
      workingset transition") introduced three new entries in memory stat
      file:
      
       - workingset_refault
       - workingset_activate
       - workingset_nodereclaim
      
      This commit adds a corresponding description to the cgroup v2 docs.
      
      Link: http://lkml.kernel.org/r/1494530293-31236-1-git-send-email-guro@fb.com
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b340959e
    • Minchan Kim's avatar
      mm: vmscan: scan until it finds eligible pages · 791b48b6
      Minchan Kim authored
      Although there are a ton of free swap and anonymous LRU page in elgible
      zones, OOM happened.
      
        balloon invoked oom-killer: gfp_mask=0x17080c0(GFP_KERNEL_ACCOUNT|__GFP_ZERO|__GFP_NOTRACK), nodemask=(null),  order=0, oom_score_adj=0
        CPU: 7 PID: 1138 Comm: balloon Not tainted 4.11.0-rc6-mm1-zram-00289-ge228d67e9677-dirty #17
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
        Call Trace:
         oom_kill_process+0x21d/0x3f0
         out_of_memory+0xd8/0x390
         __alloc_pages_slowpath+0xbc1/0xc50
         __alloc_pages_nodemask+0x1a5/0x1c0
         pte_alloc_one+0x20/0x50
         __pte_alloc+0x1e/0x110
         __handle_mm_fault+0x919/0x960
         handle_mm_fault+0x77/0x120
         __do_page_fault+0x27a/0x550
         trace_do_page_fault+0x43/0x150
         do_async_page_fault+0x2c/0x90
         async_page_fault+0x28/0x30
        Mem-Info:
        active_anon:424716 inactive_anon:65314 isolated_anon:0
         active_file:52 inactive_file:46 isolated_file:0
         unevictable:0 dirty:27 writeback:0 unstable:0
         slab_reclaimable:3967 slab_unreclaimable:4125
         mapped:133 shmem:43 pagetables:1674 bounce:0
         free:4637 free_pcp:225 free_cma:0
        Node 0 active_anon:1698864kB inactive_anon:261256kB active_file:208kB inactive_file:184kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:532kB dirty:108kB writeback:0kB shmem:172kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
        DMA free:7316kB min:32kB low:44kB high:56kB active_anon:8064kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB slab_reclaimable:464kB slab_unreclaimable:40kB kernel_stack:0kB pagetables:24kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
        lowmem_reserve[]: 0 992 992 1952
        DMA32 free:9088kB min:2048kB low:3064kB high:4080kB active_anon:952176kB inactive_anon:0kB active_file:36kB inactive_file:0kB unevictable:0kB writepending:88kB present:1032192kB managed:1019388kB mlocked:0kB slab_reclaimable:13532kB slab_unreclaimable:16460kB kernel_stack:3552kB pagetables:6672kB bounce:0kB free_pcp:56kB local_pcp:24kB free_cma:0kB
        lowmem_reserve[]: 0 0 0 959
        Movable free:3644kB min:1980kB low:2960kB high:3940kB active_anon:738560kB inactive_anon:261340kB active_file:188kB inactive_file:640kB unevictable:0kB writepending:20kB present:1048444kB managed:1010816kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:832kB local_pcp:60kB free_cma:0kB
        lowmem_reserve[]: 0 0 0 0
        DMA: 1*4kB (E) 0*8kB 18*16kB (E) 10*32kB (E) 10*64kB (E) 9*128kB (ME) 8*256kB (E) 2*512kB (E) 2*1024kB (E) 0*2048kB 0*4096kB = 7524kB
        DMA32: 417*4kB (UMEH) 181*8kB (UMEH) 68*16kB (UMEH) 48*32kB (UMEH) 14*64kB (MH) 3*128kB (M) 1*256kB (H) 1*512kB (M) 2*1024kB (M) 0*2048kB 0*4096kB = 9836kB
        Movable: 1*4kB (M) 1*8kB (M) 1*16kB (M) 1*32kB (M) 0*64kB 1*128kB (M) 2*256kB (M) 4*512kB (M) 1*1024kB (M) 0*2048kB 0*4096kB = 3772kB
        378 total pagecache pages
        17 pages in swap cache
        Swap cache stats: add 17325, delete 17302, find 0/27
        Free swap  = 978940kB
        Total swap = 1048572kB
        524157 pages RAM
        0 pages HighMem/MovableOnly
        12629 pages reserved
        0 pages cma reserved
        0 pages hwpoisoned
        [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
        [  433]     0   433     4904        5      14       3       82             0 upstart-udev-br
        [  438]     0   438    12371        5      27       3      191         -1000 systemd-udevd
      
      With investigation, skipping page of isolate_lru_pages makes reclaim
      void because it returns zero nr_taken easily so LRU shrinking is
      effectively nothing and just increases priority aggressively.  Finally,
      OOM happens.
      
      The problem is that get_scan_count determines nr_to_scan with eligible
      zones so although priority drops to zero, it couldn't reclaim any pages
      if the LRU contains mostly ineligible pages.
      
      get_scan_count:
      
              size = lruvec_lru_size(lruvec, lru, sc->reclaim_idx);
      	size = size >> sc->priority;
      
      Assumes sc->priority is 0 and LRU list is as follows.
      
      	N-N-N-N-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H
      
      (Ie, small eligible pages are in the head of LRU but others are
       almost ineligible pages)
      
      In that case, size becomes 4 so VM want to scan 4 pages but 4 pages from
      tail of the LRU are not eligible pages.  If get_scan_count counts
      skipped pages, it doesn't reclaim any pages remained after scanning 4
      pages so it ends up OOM happening.
      
      This patch makes isolate_lru_pages try to scan pages until it encounters
      eligible zones's pages.
      
      [akpm@linux-foundation.org: clean up mind-bending `for' statement.  Tweak comment text]
      Fixes: 3db65812
      
       ("Revert "mm, vmscan: account for skipped pages as a partial scan"")
      Link: http://lkml.kernel.org/r/1494457232-27401-1-git-send-email-minchan@kernel.org
      Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      791b48b6
    • David Rientjes's avatar
      mm, thp: copying user pages must schedule on collapse · 338a16ba
      David Rientjes authored
      
      
      We have encountered need_resched warnings in __collapse_huge_page_copy()
      while doing {clear,copy}_user_highpage() over HPAGE_PMD_NR source pages.
      
      mm->mmap_sem is held for write, but the iteration is well bounded.
      
      Reschedule as needed.
      
      Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1705101426380.109808@chino.kir.corp.google.com
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      338a16ba
    • Ross Zwisler's avatar
      dax: fix PMD data corruption when fault races with write · 876f2946
      Ross Zwisler authored
      This is based on a patch from Jan Kara that fixed the equivalent race in
      the DAX PTE fault path.
      
      Currently DAX PMD read fault can race with write(2) in the following
      way:
      
      CPU1 - write(2)                 CPU2 - read fault
                                      dax_iomap_pmd_fault()
                                        ->iomap_begin() - sees hole
      
      dax_iomap_rw()
        iomap_apply()
          ->iomap_begin - allocates blocks
          dax_iomap_actor()
            invalidate_inode_pages2_range()
              - there's nothing to invalidate
      
                                        grab_mapping_entry()
      				  - we add huge zero page to the radix tree
      				    and map it to page tables
      
      The result is that hole page is mapped into page tables (and thus zeros
      are seen in mmap) while file has data written in that place.
      
      Fix the problem by locking exception entry before mapping blocks for the
      fault.  That way we are sure invalidate_inode_pages2_range() call for
      racing write will either block on entry lock waiting for the fault to
      finish (and unmap stale page tables after that) or read fault will see
      already allocated blocks by write(2).
      
      Fixes: 9f141d6e
      
       ("dax: Call ->iomap_begin without entry lock during dax fault")
      Link: http://lkml.kernel.org/r/20170510172700.18991-1-ross.zwisler@linux.intel.com
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      876f2946
    • Jan Kara's avatar
      dax: fix data corruption when fault races with write · 13e451fd
      Jan Kara authored
      Currently DAX read fault can race with write(2) in the following way:
      
      CPU1 - write(2)			CPU2 - read fault
      				dax_iomap_pte_fault()
      				  ->iomap_begin() - sees hole
      dax_iomap_rw()
        iomap_apply()
          ->iomap_begin - allocates blocks
          dax_iomap_actor()
            invalidate_inode_pages2_range()
              - there's nothing to invalidate
      				  grab_mapping_entry()
      				  - we add zero page in the radix tree
      				    and map it to page tables
      
      The result is that hole page is mapped into page tables (and thus zeros
      are seen in mmap) while file has data written in that place.
      
      Fix the problem by locking exception entry before mapping blocks for the
      fault.  That way we are sure invalidate_inode_pages2_range() call for
      racing write will either block on entry lock waiting for the fault to
      finish (and unmap stale page tables after that) or read fault will see
      already allocated blocks by write(2).
      
      Fixes: 9f141d6e
      
      
      Link: http://lkml.kernel.org/r/20170510085419.27601-5-jack@suse.cz
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      13e451fd