Skip to content
  1. Mar 15, 2020
  2. Mar 06, 2020
    • Qiujun Huang's avatar
      ext4: fix a data race at inode->i_disksize · dce8e237
      Qiujun Huang authored
      
      
      KCSAN find inode->i_disksize could be accessed concurrently.
      
      BUG: KCSAN: data-race in ext4_mark_iloc_dirty / ext4_write_end
      
      write (marked) to 0xffff8b8932f40090 of 8 bytes by task 66792 on cpu 0:
       ext4_write_end+0x53f/0x5b0
       ext4_da_write_end+0x237/0x510
       generic_perform_write+0x1c4/0x2a0
       ext4_buffered_write_iter+0x13a/0x210
       ext4_file_write_iter+0xe2/0x9b0
       new_sync_write+0x29c/0x3a0
       __vfs_write+0x92/0xa0
       vfs_write+0xfc/0x2a0
       ksys_write+0xe8/0x140
       __x64_sys_write+0x4c/0x60
       do_syscall_64+0x8a/0x2a0
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      read to 0xffff8b8932f40090 of 8 bytes by task 14414 on cpu 1:
       ext4_mark_iloc_dirty+0x716/0x1190
       ext4_mark_inode_dirty+0xc9/0x360
       ext4_convert_unwritten_extents+0x1bc/0x2a0
       ext4_convert_unwritten_io_end_vec+0xc5/0x150
       ext4_put_io_end+0x82/0x130
       ext4_writepages+0xae7/0x16f0
       do_writepages+0x64/0x120
       __writeback_single_inode+0x7d/0x650
       writeback_sb_inodes+0x3a4/0x860
       __writeback_inodes_wb+0xc4/0x150
       wb_writeback+0x43f/0x510
       wb_workfn+0x3b2/0x8a0
       process_one_work+0x39b/0x7e0
       worker_thread+0x88/0x650
       kthread+0x1d4/0x1f0
       ret_from_fork+0x35/0x40
      
      The plain read is outside of inode->i_data_sem critical section
      which results in a data race. Fix it by adding READ_ONCE().
      
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Link: https://lore.kernel.org/r/1582556566-3909-1-git-send-email-hqjagain@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      dce8e237
    • Qian Cai's avatar
      ext4: fix a data race at inode->i_blocks · 28936b62
      Qian Cai authored
      
      
      inode->i_blocks could be accessed concurrently as noticed by KCSAN,
      
       BUG: KCSAN: data-race in ext4_do_update_inode [ext4] / inode_add_bytes
      
       write to 0xffff9a00d4b982d0 of 8 bytes by task 22100 on cpu 118:
        inode_add_bytes+0x65/0xf0
        __inode_add_bytes at fs/stat.c:689
        (inlined by) inode_add_bytes at fs/stat.c:702
        ext4_mb_new_blocks+0x418/0xca0 [ext4]
        ext4_ext_map_blocks+0x1a6b/0x27b0 [ext4]
        ext4_map_blocks+0x1a9/0x950 [ext4]
        _ext4_get_block+0xfc/0x270 [ext4]
        ext4_get_block_unwritten+0x33/0x50 [ext4]
        __block_write_begin_int+0x22e/0xae0
        __block_write_begin+0x39/0x50
        ext4_write_begin+0x388/0xb50 [ext4]
        ext4_da_write_begin+0x35f/0x8f0 [ext4]
        generic_perform_write+0x15d/0x290
        ext4_buffered_write_iter+0x11f/0x210 [ext4]
        ext4_file_write_iter+0xce/0x9e0 [ext4]
        new_sync_write+0x29c/0x3b0
        __vfs_write+0x92/0xa0
        vfs_write+0x103/0x260
        ksys_write+0x9d/0x130
        __x64_sys_write+0x4c/0x60
        do_syscall_64+0x91/0xb05
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       read to 0xffff9a00d4b982d0 of 8 bytes by task 8 on cpu 65:
        ext4_do_update_inode+0x4a0/0xf60 [ext4]
        ext4_inode_blocks_set at fs/ext4/inode.c:4815
        ext4_mark_iloc_dirty+0xaf/0x160 [ext4]
        ext4_mark_inode_dirty+0x129/0x3e0 [ext4]
        ext4_convert_unwritten_extents+0x253/0x2d0 [ext4]
        ext4_convert_unwritten_io_end_vec+0xc5/0x150 [ext4]
        ext4_end_io_rsv_work+0x22c/0x350 [ext4]
        process_one_work+0x54f/0xb90
        worker_thread+0x80/0x5f0
        kthread+0x1cd/0x1f0
        ret_from_fork+0x27/0x50
      
       4 locks held by kworker/u256:0/8:
        #0: ffff9a025abc4328 ((wq_completion)ext4-rsv-conversion){+.+.}, at: process_one_work+0x443/0xb90
        #1: ffffab5a862dbe20 ((work_completion)(&ei->i_rsv_conversion_work)){+.+.}, at: process_one_work+0x443/0xb90
        #2: ffff9a025a9d0f58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
        #3: ffff9a00d4b985d8 (&(&ei->i_raw_lock)->rlock){+.+.}, at: ext4_do_update_inode+0xaa/0xf60 [ext4]
       irq event stamp: 3009267
       hardirqs last  enabled at (3009267): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
       hardirqs last disabled at (3009266): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
       softirqs last  enabled at (3009230): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
       softirqs last disabled at (3009223): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0
      
       Reported by Kernel Concurrency Sanitizer on:
       CPU: 65 PID: 8 Comm: kworker/u256:0 Tainted: G L 5.6.0-rc2-next-20200221+ #7
       Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019
       Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work [ext4]
      
      The plain read is outside of inode->i_lock critical section which
      results in a data race. Fix it by adding READ_ONCE() there.
      
      Link: https://lore.kernel.org/r/20200222043258.2279-1-cai@lca.pw
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      28936b62
    • Eric Whitney's avatar
      ext4: clean up error return for convert_initialized_extent() · f064a9d6
      Eric Whitney authored
      
      
      Although convert_initialized_extent() can potentially return an error
      code with a negative value, its returned value is assigned to an
      unsigned variable containing a block count in ext4_ext_map_blocks() and
      then returned to that function's caller. The code currently works,
      though the way this happens is obscure.  The code would be more
      readable if it followed the error handling convention used elsewhere
      in ext4_ext_map_blocks().
      
      This patch does not address any known test failure or bug report - it's
      simply a cleanup.  It also addresses a nearby coding standard issue.
      
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Link: https://lore.kernel.org/r/20200218202656.21561-1-enwlinux@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      f064a9d6
    • zhangyi (F)'s avatar
      jbd2: improve comments about freeing data buffers whose page mapping is NULL · 780f66e5
      zhangyi (F) authored
      Improve comments in jbd2_journal_commit_transaction() to describe why
      we don't need to clear the buffer_mapped bit for freeing file mapping
      buffers whose page mapping is NULL.
      
      Link: https://lore.kernel.org/r/20200217112706.20085-1-yi.zhang@huawei.com
      Fixes: c96dceea
      
       ("jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer")
      Suggested-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      780f66e5
    • Gustavo A. R. Silva's avatar
      ext4: use flexible-array members in struct dx_node and struct dx_root · 6cfb061f
      Gustavo A. R. Silva authored
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732
      
       ("cxgb3/l2t: Fix undefined behaviour")
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Link: https://lore.kernel.org/r/20200213160648.GA7054@embeddedor
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      6cfb061f
    • Madhuparna Bhowmik's avatar
      ext4: use built-in RCU list checking in mballoc · 92e9c58c
      Madhuparna Bhowmik authored
      
      
      list_for_each_entry_rcu() has built-in RCU and lock checking.
      
      Pass cond argument to list_for_each_entry_rcu() to silence
      false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
      by default.
      
      Signed-off-by: default avatarMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
      Link: https://lore.kernel.org/r/20200213152558.7070-1-madhuparnabhowmik10@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      92e9c58c
    • Eric Whitney's avatar
      ext4: delete declaration for ext4_split_extent() · 765bfcd5
      Eric Whitney authored
      
      
      There are no forward references for ext4_split_extent() in extents.c,
      so delete its unnecessary declaration.
      
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Link: https://lore.kernel.org/r/20200212162141.22381-1-enwlinux@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      765bfcd5
    • Eric Whitney's avatar
      ext4: remove EXT4_EOFBLOCKS_FL and associated code · 4337ecd1
      Eric Whitney authored
      
      
      The EXT4_EOFBLOCKS_FL inode flag is used to indicate whether a file
      contains unwritten blocks past i_size.  It's set when ext4_fallocate
      is called with the KEEP_SIZE flag to extend a file with an unwritten
      extent.  However, this flag hasn't been useful functionally since
      March, 2012, when a decision was made to remove it from ext4.
      
      All traces of EXT4_EOFBLOCKS_FL were removed from e2fsprogs version
      1.42.2 by commit 010dc7b90d97 ("e2fsck: remove EXT4_EOFBLOCKS_FL flag
      handling") at that time.  Now that enough time has passed to make
      e2fsprogs versions containing this modification common, this patch now
      removes the code associated with EXT4_EOFBLOCKS_FL from the kernel as
      well.
      
      This change has two implications.  First, because pre-1.42.2 e2fsck
      versions only look for a problem if EXT4_EOFBLOCKS_FL is set, and
      because that bit will never be set by newer kernels containing this
      patch, old versions of e2fsck won't have a compatibility problem with
      files created by newer kernels.
      
      Second, newer kernels will not clear EXT4_EOFBLOCKS_FL inode flag bits
      belonging to a file written by an older kernel.  If set, it will remain
      in that state until the file is deleted.  Because e2fsck versions since
      1.42.2 don't check the flag at all, no adverse effect is expected.
      However, pre-1.42.2 e2fsck versions that do check the flag may report
      that it is set when it ought not to be after a file has been truncated
      or had its unwritten blocks written.  In this case, the old version of
      e2fsck will offer to clear the flag.  No adverse effect would then
      occur whether the user chooses to clear the flag or not.
      
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Link: https://lore.kernel.org/r/20200211210216.24960-1-enwlinux@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      4337ecd1
    • Chengguang Xu's avatar
      ext4: code cleanup for ext4_statfs_project() · a08fe66e
      Chengguang Xu authored
      
      
      Calling min_not_zero() to simplify complicated prjquota
      limit comparison in ext4_statfs_project().
      
      Signed-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
      Link: https://lore.kernel.org/r/20200210082445.2379-1-cgxu519@mykernel.net
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      a08fe66e
    • Xiaoguang Wang's avatar
      ext4: start to support iopoll method · 72f9da1d
      Xiaoguang Wang authored
      Since commit "b1b4705d
      
       ext4: introduce direct I/O read using
      iomap infrastructure", we can easily make ext4 support iopoll
      method, just use iomap_dio_iopoll().
      
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
      Link: https://lore.kernel.org/r/20200207120758.2411-1-xiaoguang.wang@linux.alibaba.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      72f9da1d
    • Harshad Shirwadkar's avatar
      ext4: force buffer up-to-date while marking it dirty · f2eeca09
      Harshad Shirwadkar authored
      
      
      Writeback errors can leave buffer in not up-to-date state when there
      are errors during background writes. Force buffer up-to-date while
      marking it dirty.
      
      Signed-off-by: default avatarHarshad Shirwadkar <harshadshirwadkar@gmail.com>
      Link: https://lore.kernel.org/r/20191224190940.157952-1-harshadshirwadkar@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      f2eeca09
  3. Mar 02, 2020
    • Linus Torvalds's avatar
      Linux 5.6-rc4 · 98d54f81
      Linus Torvalds authored
      98d54f81
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · e7086982
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Two more bug fixes (including a regression) for 5.6"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
        jbd2: fix data races at struct journal_head
      e7086982
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · f853ed90
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "More bugfixes, including a few remaining "make W=1" issues such as too
        large frame sizes on some configurations.
      
        On the ARM side, the compiler was messing up shadow stacks between EL1
        and EL2 code, which is easily fixed with __always_inline"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: VMX: check descriptor table exits on instruction emulation
        kvm: x86: Limit the number of "kvm: disabled by bios" messages
        KVM: x86: avoid useless copy of cpufreq policy
        KVM: allow disabling -Werror
        KVM: x86: allow compiling as non-module with W=1
        KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis
        KVM: Introduce pv check helpers
        KVM: let declaration of kvm_get_running_vcpus match implementation
        KVM: SVM: allocate AVIC data structures based on kvm_amd module parameter
        arm64: Ask the compiler to __always_inline functions used by KVM at HYP
        KVM: arm64: Define our own swab32() to avoid a uapi static inline
        KVM: arm64: Ask the compiler to __always_inline functions used at HYP
        kvm: arm/arm64: Fold VHE entry/exit work into kvm_vcpu_run_vhe()
        KVM: arm/arm64: Fix up includes for trace.h
      f853ed90
    • Oliver Upton's avatar
      KVM: VMX: check descriptor table exits on instruction emulation · 86f7e90c
      Oliver Upton authored
      KVM emulates UMIP on hardware that doesn't support it by setting the
      'descriptor table exiting' VM-execution control and performing
      instruction emulation. When running nested, this emulation is broken as
      KVM refuses to emulate L2 instructions by default.
      
      Correct this regression by allowing the emulation of descriptor table
      instructions if L1 hasn't requested 'descriptor table exiting'.
      
      Fixes: 07721fee
      
       ("KVM: nVMX: Don't emulate instructions in guest mode")
      Reported-by: default avatarJan Kiszka <jan.kiszka@web.de>
      Cc: stable@vger.kernel.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Jim Mattson <jmattson@google.com>
      Signed-off-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      86f7e90c
  4. Mar 01, 2020
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · fb279f4e
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "I2C has three driver bugfixes for you. We agreed on the Mac regression
        to go in via I2C"
      
      * 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        macintosh: therm_windtunnel: fix regression when instantiating devices
        i2c: altera: Fix potential integer overflow
        i2c: jz4780: silence log flood on txabrt
      fb279f4e
    • Dan Carpenter's avatar
      ext4: potential crash on allocation error in ext4_alloc_flex_bg_array() · 37b0b6b8
      Dan Carpenter authored
      If sbi->s_flex_groups_allocated is zero and the first allocation fails
      then this code will crash.  The problem is that "i--" will set "i" to
      -1 but when we compare "i >= sbi->s_flex_groups_allocated" then the -1
      is type promoted to unsigned and becomes UINT_MAX.  Since UINT_MAX
      is more than zero, the condition is true so we call kvfree(new_groups[-1]).
      The loop will carry on freeing invalid memory until it crashes.
      
      Fixes: 7c990728
      
       ("ext4: fix potential race between s_flex_groups online resizing and access")
      Reviewed-by: default avatarSuraj Jitindar Singh <surajjs@amazon.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: stable@kernel.org
      Link: https://lore.kernel.org/r/20200228092142.7irbc44yaz3by7nb@kili.mountain
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      37b0b6b8
    • Wolfram Sang's avatar
      macintosh: therm_windtunnel: fix regression when instantiating devices · 38b17afb
      Wolfram Sang authored
      Removing attach_adapter from this driver caused a regression for at
      least some machines. Those machines had the sensors described in their
      DT, too, so they didn't need manual creation of the sensor devices. The
      old code worked, though, because manual creation came first. Creation of
      DT devices then failed later and caused error logs, but the sensors
      worked nonetheless because of the manually created devices.
      
      When removing attach_adaper, manual creation now comes later and loses
      the race. The sensor devices were already registered via DT, yet with
      another binding, so the driver could not be bound to it.
      
      This fix refactors the code to remove the race and only manually creates
      devices if there are no DT nodes present. Also, the DT binding is updated
      to match both, the DT and manually created devices. Because we don't
      know which device creation will be used at runtime, the code to start
      the kthread is moved to do_probe() which will be called by both methods.
      
      Fixes: 3e7bed52
      
       ("macintosh: therm_windtunnel: drop using attach_adapter")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=201723
      Reported-by: default avatarErhard Furtner <erhard_f@mailbox.org>
      Tested-by: default avatarErhard Furtner <erhard_f@mailbox.org>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org # v4.19+
      38b17afb
    • Qian Cai's avatar
      jbd2: fix data races at struct journal_head · 6c5d9112
      Qian Cai authored
      
      
      journal_head::b_transaction and journal_head::b_next_transaction could
      be accessed concurrently as noticed by KCSAN,
      
       LTP: starting fsync04
       /dev/zero: Can't open blockdev
       EXT4-fs (loop0): mounting ext3 file system using the ext4 subsystem
       EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null)
       ==================================================================
       BUG: KCSAN: data-race in __jbd2_journal_refile_buffer [jbd2] / jbd2_write_access_granted [jbd2]
      
       write to 0xffff99f9b1bd0e30 of 8 bytes by task 25721 on cpu 70:
        __jbd2_journal_refile_buffer+0xdd/0x210 [jbd2]
        __jbd2_journal_refile_buffer at fs/jbd2/transaction.c:2569
        jbd2_journal_commit_transaction+0x2d15/0x3f20 [jbd2]
        (inlined by) jbd2_journal_commit_transaction at fs/jbd2/commit.c:1034
        kjournald2+0x13b/0x450 [jbd2]
        kthread+0x1cd/0x1f0
        ret_from_fork+0x27/0x50
      
       read to 0xffff99f9b1bd0e30 of 8 bytes by task 25724 on cpu 68:
        jbd2_write_access_granted+0x1b2/0x250 [jbd2]
        jbd2_write_access_granted at fs/jbd2/transaction.c:1155
        jbd2_journal_get_write_access+0x2c/0x60 [jbd2]
        __ext4_journal_get_write_access+0x50/0x90 [ext4]
        ext4_mb_mark_diskspace_used+0x158/0x620 [ext4]
        ext4_mb_new_blocks+0x54f/0xca0 [ext4]
        ext4_ind_map_blocks+0xc79/0x1b40 [ext4]
        ext4_map_blocks+0x3b4/0x950 [ext4]
        _ext4_get_block+0xfc/0x270 [ext4]
        ext4_get_block+0x3b/0x50 [ext4]
        __block_write_begin_int+0x22e/0xae0
        __block_write_begin+0x39/0x50
        ext4_write_begin+0x388/0xb50 [ext4]
        generic_perform_write+0x15d/0x290
        ext4_buffered_write_iter+0x11f/0x210 [ext4]
        ext4_file_write_iter+0xce/0x9e0 [ext4]
        new_sync_write+0x29c/0x3b0
        __vfs_write+0x92/0xa0
        vfs_write+0x103/0x260
        ksys_write+0x9d/0x130
        __x64_sys_write+0x4c/0x60
        do_syscall_64+0x91/0xb05
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       5 locks held by fsync04/25724:
        #0: ffff99f9911093f8 (sb_writers#13){.+.+}, at: vfs_write+0x21c/0x260
        #1: ffff99f9db4c0348 (&sb->s_type->i_mutex_key#15){+.+.}, at: ext4_buffered_write_iter+0x65/0x210 [ext4]
        #2: ffff99f5e7dfcf58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
        #3: ffff99f9db4c0168 (&ei->i_data_sem){++++}, at: ext4_map_blocks+0x176/0x950 [ext4]
        #4: ffffffff99086b40 (rcu_read_lock){....}, at: jbd2_write_access_granted+0x4e/0x250 [jbd2]
       irq event stamp: 1407125
       hardirqs last  enabled at (1407125): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
       hardirqs last disabled at (1407124): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
       softirqs last  enabled at (1405528): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
       softirqs last disabled at (1405521): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0
      
       Reported by Kernel Concurrency Sanitizer on:
       CPU: 68 PID: 25724 Comm: fsync04 Tainted: G L 5.6.0-rc2-next-20200221+ #7
       Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019
      
      The plain reads are outside of jh->b_state_lock critical section which result
      in data races. Fix them by adding pairs of READ|WRITE_ONCE().
      
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Link: https://lore.kernel.org/r/20200222043111.2227-1-cai@lca.pw
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      6c5d9112
  5. Feb 29, 2020
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 7557c1b3
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Four small fixes.
      
        Three are in drivers for fairly obvious bugs. The fourth is a set of
        regressions introduced by the compat_ioctl changes because some of the
        compat updates wrongly replaced .ioctl instead of .compat_ioctl"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: compat_ioctl: cdrom: Replace .ioctl with .compat_ioctl in four appropriate places
        scsi: zfcp: fix wrong data and display format of SFP+ temperature
        scsi: sd_sbc: Fix sd_zbc_report_zones()
        scsi: libfc: free response frame from GPN_ID
      7557c1b3
    • Linus Torvalds's avatar
      Merge tag 'pci-v5.6-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 29795de0
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - Fix build issue on 32-bit ARM with old compilers (Marek Szyprowski)
      
       - Update MAINTAINERS for recent Cadence driver file move (Lukas
         Bulwahn)
      
      * tag 'pci-v5.6-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        MAINTAINERS: Correct Cadence PCI driver path
        PCI: brcmstb: Fix build on 32bit ARM platforms with older compilers
      29795de0
    • Linus Torvalds's avatar
      Merge tag 'block-5.6-2020-02-28' of git://git.kernel.dk/linux-block · 2edc78b9
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - Passthrough insertion fix (Ming)
      
       - Kill off some unused arguments (John)
      
       - blktrace RCU fix (Jan)
      
       - Dead fields removal for null_blk (Dongli)
      
       - NVMe polled IO fix (Bijan)
      
      * tag 'block-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
        nvme-pci: Hold cq_poll_lock while completing CQEs
        blk-mq: Remove some unused function arguments
        null_blk: remove unused fields in 'nullb_cmd'
        blktrace: Protect q->blk_trace with RCU
        blk-mq: insert passthrough request into hctx->dispatch directly
      2edc78b9
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.6-2020-02-28' of git://git.kernel.dk/linux-block · 74dea5d9
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Fix for a race with IOPOLL used with SQPOLL (Xiaoguang)
      
       - Only show ->fdinfo if procfs is enabled (Tobias)
      
       - Fix for a chain with multiple personalities in the SQEs
      
       - Fix for a missing free of personality idr on exit
      
       - Removal of the spin-for-work optimization
      
       - Fix for next work lookup on request completion
      
       - Fix for non-vec read/write result progation in case of links
      
       - Fix for a fileset references on switch
      
       - Fix for a recvmsg/sendmsg 32-bit compatability mode
      
      * tag 'io_uring-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
        io_uring: fix 32-bit compatability with sendmsg/recvmsg
        io_uring: define and set show_fdinfo only if procfs is enabled
        io_uring: drop file set ref put/get on switch
        io_uring: import_single_range() returns 0/-ERROR
        io_uring: pick up link work on submit reference drop
        io-wq: ensure work->task_pid is cleared on init
        io-wq: remove spin-for-work optimization
        io_uring: fix poll_list race for SETUP_IOPOLL|SETUP_SQPOLL
        io_uring: fix personality idr leak
        io_uring: handle multiple personalities in link chains
      74dea5d9
    • Jens Axboe's avatar
      Merge branch 'nvme-5.6-rc4' of git://git.infradead.org/nvme into block-5.6 · 5b8ea58b
      Jens Axboe authored
      Pull NVMe fix from Keith.
      
      * 'nvme-5.6-rc4' of git://git.infradead.org/nvme:
        nvme-pci: Hold cq_poll_lock while completing CQEs
      5b8ea58b
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c60c0402
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
       "Fix a couple of configuration issues in the ACPI watchdog (WDAT)
        driver (Mika Westerberg) and make it possible to disable that driver
        at boot time in case it still does not work as expected (Jean
        Delvare)"
      
      * tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: watchdog: Set default timeout in probe
        ACPI: watchdog: Fix gas->access_width usage
        ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
        ACPI: watchdog: Allow disabling WDAT at boot
      c60c0402
    • Linus Torvalds's avatar
      Merge tag 'pm-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 36428598
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "Fix a recent cpufreq initialization regression (Rafael Wysocki),
        revert a devfreq commit that made incompatible changes and broke user
        land on some systems (Orson Zhai), drop a stale reference to a
        document that has gone away recently (Jonathan Neuschäfer), and fix a
        typo in a hibernation code comment (Alexandre Belloni)"
      
      * tag 'pm-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: Fix policy initialization for internal governor drivers
        Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
        PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
        Documentation: power: Drop reference to interface.rst
      36428598
    • Linus Torvalds's avatar
      Merge tag 'zonefs-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · bfeb4f99
      Linus Torvalds authored
      Pull zonefs fixes from Damien Le Moal:
       "Two fixes in here:
      
         - Revert the initial decision to silently ignore IOCB_NOWAIT for
           asynchronous direct IOs to sequential zone files. Instead, return
           an error to the user to signal that the feature is not supported
           (from Christoph)
      
         - A fix to zonefs Kconfig to select FS_IOMAP to avoid build failures
           if no other file system already selected this option (from
           Johannes)"
      
      * tag 'zonefs-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        zonefs: select FS_IOMAP
        zonefs: fix IOCB_NOWAIT handling
      bfeb4f99
  6. Feb 28, 2020
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-5.6-1' of... · e951445f
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm fixes for 5.6, take #1
      
      - Fix compilation on 32bit
      - Move  VHE guest entry/exit into the VHE-specific entry code
      - Make sure all functions called by the non-VHE HYP code is tagged as __always_inline
      e951445f
    • Erwan Velu's avatar
      kvm: x86: Limit the number of "kvm: disabled by bios" messages · ef935c25
      Erwan Velu authored
      
      
      In older version of systemd(219), at boot time, udevadm is called with :
      	/usr/bin/udevadm trigger --type=devices --action=add"
      
      This program generates an echo "add" in /sys/devices/system/cpu/cpu<x>/uevent,
      leading to the "kvm: disabled by bios" message in case of your Bios disabled
      the virtualization extensions.
      
      On a modern system running up to 256 CPU threads, this pollutes the Kernel logs.
      
      This patch offers to ratelimit this message to avoid any userspace program triggering
      this uevent printing this message too often.
      
      This patch is only a workaround but greatly reduce the pollution without
      breaking the current behavior of printing a message if some try to instantiate
      KVM on a system that doesn't support it.
      
      Note that recent versions of systemd (>239) do not have trigger this behavior.
      
      This patch will be useful at least for some using older systemd with recent Kernels.
      
      Signed-off-by: default avatarErwan Velu <e.velu@criteo.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ef935c25
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-sleep' and 'pm-devfreq' · 189c6967
      Rafael J. Wysocki authored
      * pm-sleep:
        PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
        Documentation: power: Drop reference to interface.rst
      
      * pm-devfreq:
        Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
      189c6967
    • Paolo Bonzini's avatar
      KVM: x86: avoid useless copy of cpufreq policy · aaec7c03
      Paolo Bonzini authored
      
      
      struct cpufreq_policy is quite big and it is not a good idea
      to allocate one on the stack.  Just use cpufreq_cpu_get and
      cpufreq_cpu_put which is even simpler.
      
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      aaec7c03
    • Paolo Bonzini's avatar
      KVM: allow disabling -Werror · 4f337faf
      Paolo Bonzini authored
      
      
      Restrict -Werror to well-tested configurations and allow disabling it
      via Kconfig.
      
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4f337faf