1. 06 Nov, 2018 5 commits
  2. 03 Nov, 2018 4 commits
  3. 12 Oct, 2018 1 commit
  4. 07 Oct, 2018 1 commit
  5. 05 Oct, 2018 3 commits
  6. 03 Oct, 2018 7 commits
  7. 02 Oct, 2018 3 commits
    • Theodore Ts'o's avatar
      ext4: fix EXT4_IOC_SWAP_BOOT · 18aded17
      Theodore Ts'o authored
      The code EXT4_IOC_SWAP_BOOT ioctl hasn't been updated in a while, and
      it's a bit broken with respect to more modern ext4 kernels, especially
      metadata checksums.
      
      Other problems fixed with this commit:
      
      * Don't allow installing a DAX, swap file, or an encrypted file as a
        boot loader.
      
      * Respect the immutable and append-only flags.
      
      * Wait until any DIO operations are finished *before* calling
        truncate_inode_pages().
      
      * Don't swap inode->i_flags, since these flags have nothing to do with
        the inode blocks --- and it will give the IMA/audit code heartburn
        when the inode is evicted.
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Reported-by: syzbot+e81ccd4744c6c4f71354@syzkaller.appspotmail.com
      18aded17
    • Gabriel Krisman Bertazi's avatar
      ext4: fix build error when DX_DEBUG is defined · 799578ab
      Gabriel Krisman Bertazi authored
      Enabling DX_DEBUG triggers the build error below.  info is an attribute
      of  the dxroot structure.
      
      linux/fs/ext4/namei.c:2264:12: error: ‘info’
      undeclared (first use in this function); did you mean ‘insl’?
      	   	  info->indirect_levels));
      
      Fixes: e08ac99f ("ext4: add largedir feature")
      Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
      799578ab
    • Theodore Ts'o's avatar
      ext4: fix argument checking in EXT4_IOC_MOVE_EXT · f18b2b83
      Theodore Ts'o authored
      If the starting block number of either the source or destination file
      exceeds the EOF, EXT4_IOC_MOVE_EXT should return EINVAL.
      
      Also fixed the helper function mext_check_coverage() so that if the
      logical block is beyond EOF, make it return immediately, instead of
      looping until the block number wraps all the away around.  This takes
      long enough that if there are multiple threads trying to do pound on
      an the same inode doing non-sensical things, it can end up triggering
      the kernel's soft lockup detector.
      
      Reported-by: syzbot+c61979f6f2cba5cb3c06@syzkaller.appspotmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      f18b2b83
  8. 01 Oct, 2018 6 commits
    • Eric Whitney's avatar
      ext4: fix reserved cluster accounting at page invalidation time · f456767d
      Eric Whitney authored
      Add new code to count canceled pending cluster reservations on bigalloc
      file systems and to reduce the cluster reservation count on all file
      systems using delayed allocation.  This replaces old code in
      ext4_da_page_release_reservations that was incorrect.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      f456767d
    • Eric Whitney's avatar
      ext4: adjust reserved cluster count when removing extents · 9fe67149
      Eric Whitney authored
      Modify ext4_ext_remove_space() and the code it calls to correct the
      reserved cluster count for pending reservations (delayed allocated
      clusters shared with allocated blocks) when a block range is removed
      from the extent tree.  Pending reservations may be found for the clusters
      at the ends of written or unwritten extents when a block range is removed.
      If a physical cluster at the end of an extent is freed, it's necessary
      to increment the reserved cluster count to maintain correct accounting
      if the corresponding logical cluster is shared with at least one
      delayed and unwritten extent as found in the extents status tree.
      
      Add a new function, ext4_rereserve_cluster(), to reapply a reservation
      on a delayed allocated cluster sharing blocks with a freed allocated
      cluster.  To avoid ENOSPC on reservation, a flag is applied to
      ext4_free_blocks() to briefly defer updating the freeclusters counter
      when an allocated cluster is freed.  This prevents another thread
      from allocating the freed block before the reservation can be reapplied.
      
      Redefine the partial cluster object as a struct to carry more state
      information and to clarify the code using it.
      
      Adjust the conditional code structure in ext4_ext_remove_space to
      reduce the indentation level in the main body of the code to improve
      readability.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      9fe67149
    • Eric Whitney's avatar
      ext4: reduce reserved cluster count by number of allocated clusters · b6bf9171
      Eric Whitney authored
      Ext4 does not always reduce the reserved cluster count by the number
      of clusters allocated when mapping a delayed extent.  It sometimes
      adds back one or more clusters after allocation if delalloc blocks
      adjacent to the range allocated by ext4_ext_map_blocks() share the
      clusters newly allocated for that range.  However, this overcounts
      the number of clusters needed to satisfy future mapping requests
      (holding one or more reservations for clusters that have already been
      allocated) and premature ENOSPC and quota failures, etc., result.
      
      Ext4 also does not reduce the reserved cluster count when allocating
      clusters for non-delayed allocated writes that have previously been
      reserved for delayed writes.  This also results in overcounts.
      
      To make it possible to handle reserved cluster accounting for
      fallocated regions in the same manner as used for other non-delayed
      writes, do the reserved cluster accounting for them at the time of
      allocation.  In the current code, this is only done later when a
      delayed extent sharing the fallocated region is finally mapped.
      
      Address comment correcting handling of unsigned long long constant
      from Jan Kara's review of RFC version of this patch.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      b6bf9171
    • Eric Whitney's avatar
      ext4: fix reserved cluster accounting at delayed write time · 0b02f4c0
      Eric Whitney authored
      The code in ext4_da_map_blocks sometimes reserves space for more
      delayed allocated clusters than it should, resulting in premature
      ENOSPC, exceeded quota, and inaccurate free space reporting.
      
      Fix this by checking for written and unwritten blocks shared in the
      same cluster with the newly delayed allocated block.  A cluster
      reservation should not be made for a cluster for which physical space
      has already been allocated.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      0b02f4c0
    • Eric Whitney's avatar
      ext4: add new pending reservation mechanism · 1dc0aa46
      Eric Whitney authored
      Add new pending reservation mechanism to help manage reserved cluster
      accounting.  Its primary function is to avoid the need to read extents
      from the disk when invalidating pages as a result of a truncate, punch
      hole, or collapse range operation.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      1dc0aa46
    • Eric Whitney's avatar
      ext4: generalize extents status tree search functions · ad431025
      Eric Whitney authored
      Ext4 contains a few functions that are used to search for delayed
      extents or blocks in the extents status tree.  Rather than duplicate
      code to add new functions to search for extents with different status
      values, such as written or a combination of delayed and unwritten,
      generalize the existing code to search for caller-specified extents
      status values.  Also, move this code into extents_status.c where it
      is better associated with the data structures it operates upon, and
      where it can be more readily used to implement new extents status tree
      functions that might want a broader scope for i_es_lock.
      
      Three missing static specifiers in RFC version of patch reported and
      fixed by Fengguang Wu <fengguang.wu@intel.com>.
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      ad431025
  9. 30 Sep, 2018 4 commits
  10. 29 Sep, 2018 6 commits