Skip to content
  1. Apr 02, 2020
  2. Mar 29, 2020
  3. Mar 26, 2020
    • Eric Whitney's avatar
      ext4: disable dioread_nolock whenever delayed allocation is disabled · c8980e19
      Eric Whitney authored
      The patch "ext4: make dioread_nolock the default" (244adf64
      
      ) causes
      generic/422 to fail when run in kvm-xfstests' ext3conv test case.  This
      applies both the dioread_nolock and nodelalloc mount options, a
      combination not previously tested by kvm-xfstests.  The failure occurs
      because the dioread_nolock code path splits a previously fallocated
      multiblock extent into a series of single block extents when overwriting
      a portion of that extent.  That causes allocation of an extent tree leaf
      node and a reshuffling of extents.  Once writeback is completed, the
      individual extents are recombined into a single extent, the extent is
      moved again, and the leaf node is deleted.  The difference in block
      utilization before and after writeback due to the leaf node triggers the
      failure.
      
      The original reason for this behavior was to avoid ENOSPC when handling
      I/O completions during writeback in the dioread_nolock code paths when
      delayed allocation is disabled.  It may no longer be necessary, because
      code was added in the past to reserve extra space to solve this problem
      when delayed allocation is enabled, and this code may also apply when
      delayed allocation is disabled.  Until this can be verified, don't use
      the dioread_nolock code paths if delayed allocation is disabled.
      
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Link: https://lore.kernel.org/r/20200319150028.24592-1-enwlinux@gmail.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      c8980e19
    • Eric Sandeen's avatar
      ext4: do not commit super on read-only bdev · c96e2b85
      Eric Sandeen authored
      
      
      Under some circumstances we may encounter a filesystem error on a
      read-only block device, and if we try to save the error info to the
      superblock and commit it, we'll wind up with a noisy error and
      backtrace, i.e.:
      
      [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
      ------------[ cut here ]------------
      generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
      WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
      ...
      
      To avoid this, commit the error info in the superblock only if the
      block device is writable.
      
      Reported-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      Link: https://lore.kernel.org/r/4b6e774d-cc00-3469-7abb-108eb151071a@sandeen.net
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      c96e2b85
    • Jan Kara's avatar
      ext4: avoid ENOSPC when avoiding to reuse recently deleted inodes · d05466b2
      Jan Kara authored
      
      
      When ext4 is running on a filesystem without a journal, it tries not to
      reuse recently deleted inodes to provide better chances for filesystem
      recovery in case of crash. However this logic forbids reuse of freed
      inodes for up to 5 minutes and especially for filesystems with smaller
      number of inodes can lead to ENOSPC errors returned when allocating new
      inodes.
      
      Fix the problem by allowing to reuse recently deleted inode if there's
      no other inode free in the scanned range.
      
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20200318121317.31941-1-jack@suse.cz
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      d05466b2
    • Ritesh Harjani's avatar
      ext4: unregister sysfs path before destroying jbd2 journal · 5e47868f
      Ritesh Harjani authored
      
      
      Call ext4_unregister_sysfs(), before destroying jbd2 journal,
      since below might cause, NULL pointer dereference issue.
      This got reported with LTP tests.
      
      ext4_put_super() 		cat /sys/fs/ext4/loop2/journal_task
      	| 				ext4_attr_show();
      ext4_jbd2_journal_destroy();  			|
          	|				 journal_task_show()
      	| 					|
      	| 				task_pid_vnr(NULL);
      sbi->s_journal = NULL;
      
      Signed-off-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20200318061301.4320-1-riteshh@linux.ibm.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      5e47868f
    • Ritesh Harjani's avatar
      ext4: check for non-zero journal inum in ext4_calculate_overhead · f1eec3b0
      Ritesh Harjani authored
      While calculating overhead for internal journal, also check
      that j_inum shouldn't be 0. Otherwise we get below error with
      xfstests generic/050 with external journal (XXX_LOGDEV config) enabled.
      
      It could be simply reproduced with loop device with an external journal
      and marking blockdev as RO before mounting.
      
      [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
      ------------[ cut here ]------------
      generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
      WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
      CPU: 107 PID: 115347 Comm: mount Tainted: G             L   --------- -t - 4.18.0-167.el8.ppc64le #1
      NIP:  c0000000006f6d44 LR: c0000000006f6d40 CTR: 0000000030041dd4
      <...>
      NIP [c0000000006f6d44] generic_make_request_checks+0x6b4/0x7d0
      LR [c0000000006f6d40] generic_make_request_checks+0x6b0/0x7d0
      <...>
      Call Trace:
      generic_make_request_checks+0x6b0/0x7d0 (unreliable)
      generic_make_request+0x3c/0x420
      submit_bio+0xd8/0x200
      submit_bh_wbc+0x1e8/0x250
      __sync_dirty_buffer+0xd0/0x210
      ext4_commit_super+0x310/0x420 [ext4]
      __ext4_error+0xa4/0x1e0 [ext4]
      __ext4_iget+0x388/0xe10 [ext4]
      ext4_get_journal_inode+0x40/0x150 [ext4]
      ext4_calculate_overhead+0x5a8/0x610 [ext4]
      ext4_fill_super+0x3188/0x3260 [ext4]
      mount_bdev+0x778/0x8f0
      ext4_mount+0x28/0x50 [ext4]
      mount_fs+0x74/0x230
      vfs_kern_mount.part.6+0x6c/0x250
      do_mount+0x2fc/0x1280
      sys_mount+0x158/0x180
      system_call+0x5c/0x70
      EXT4-fs (pmem1p2): no journal found
      EXT4-fs (pmem1p2): can't get journal size
      EXT4-fs (pmem1p2): mounted filesystem without journal. Opts: dax,norecovery
      
      Fixes: 3c816ded
      
       ("ext4: use journal inode to determine journal overhead")
      Reported-by: default avatarHarish Sriram <harish@linux.ibm.com>
      Signed-off-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20200316093038.25485-1-riteshh@linux.ibm.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      f1eec3b0
  4. Mar 15, 2020
  5. Mar 06, 2020
  6. 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
  7. 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
  8. Feb 29, 2020