1. 30 3月, 2018 2 次提交
  2. 27 3月, 2018 1 次提交
  3. 26 3月, 2018 2 次提交
  4. 22 3月, 2018 5 次提交
    • E
      ext4: don't complain about incorrect features when probing · 0d9366d6
      Eric Sandeen 提交于
      If mount is auto-probing for filesystem type, it will try various
      filesystems in order, with the MS_SILENT flag set.  We get
      that flag as the silent arg to ext4_fill_super.
      
      If we're probing (silent==1) then don't complain about feature
      incompatibilities that are found if it looks like it's actually
      a different valid extN type - failed probes should be silent
      in this case.
      
      If the on-disk features are unknown even to ext4, then complain.
      Reported-by: NJoakim Tjernlund <Joakim.Tjernlund@infinera.com>
      Tested-by: NJoakim Tjernlund <Joakim.Tjernlund@infinera.com>
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NJan Kara <jack@suse.cz>
      0d9366d6
    • N
      ext4: remove EXT4_STATE_DIOREAD_LOCK flag · 1d39834f
      Nikolay Borisov 提交于
      Commit 16c54688 ("ext4: Allow parallel DIO reads") reworked the way
      locking happens around parallel dio reads. This resulted in obviating
      the need for EXT4_STATE_DIOREAD_LOCK flag and accompanying logic.
      Currently this amounts to dead code so let's remove it. No functional
      changes
      Signed-off-by: NNikolay Borisov <nborisov@suse.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NJan Kara <jack@suse.cz>
      1d39834f
    • J
      ext4: fix offset overflow on 32-bit archs in ext4_iomap_begin() · fe23cb65
      Jiri Slaby 提交于
      ext4_iomap_begin() has a bug where offset returned in the iomap
      structure will be truncated to unsigned long size. On 64-bit
      architectures this is fine but on 32-bit architectures obviously not.
      Not many places actually use the offset stored in the iomap structure
      but one of visible failures is in SEEK_HOLE / SEEK_DATA implementation.
      If we create a file like:
      
      dd if=/dev/urandom of=file bs=1k seek=8m count=1
      
      then
      
      lseek64("file", 0x100000000ULL, SEEK_DATA)
      
      wrongly returns 0x100000000 on unfixed kernel while it should return
      0x200000000. Avoid the overflow by proper type cast.
      
      Fixes: 545052e9 ("ext4: Switch to iomap for SEEK_HOLE / SEEK_DATA")
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org # v4.15
      fe23cb65
    • E
      ext4: update i_disksize if direct write past ondisk size · 45d8ec4d
      Eryu Guan 提交于
      Currently in ext4 direct write path, we update i_disksize only when
      new eof is greater than i_size, and don't update it even when new
      eof is greater than i_disksize but less than i_size. This doesn't
      work well with delalloc buffer write, which updates i_size and
      i_disksize only when delalloc blocks are resolved (at writeback
      time), the i_disksize from direct write can be lost if a previous
      buffer write succeeded at write time but failed at writeback time,
      then results in corrupted ondisk inode size.
      
      Consider this case, first buffer write 4k data to a new file at
      offset 16k with delayed allocation, then direct write 4k data to the
      same file at offset 4k before delalloc blocks are resolved, which
      doesn't update i_disksize because it writes within i_size(20k), but
      the extent tree metadata has been committed in journal. Then
      writeback of the delalloc blocks fails (due to device error etc.),
      and i_size/i_disksize from buffer write can't be written to disk
      (still zero). A subsequent umount/mount cycle recovers journal and
      writes extent tree metadata from direct write to disk, but with
      i_disksize being zero.
      
      Fix it by updating i_disksize too in direct write path when new eof
      is greater than i_disksize but less than i_size, so i_disksize is
      always consistent with direct write.
      
      This fixes occasional i_size corruption in fstests generic/475.
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      45d8ec4d
    • E
      ext4: protect i_disksize update by i_data_sem in direct write path · 73fdad00
      Eryu Guan 提交于
      i_disksize update should be protected by i_data_sem, by either taking
      the lock explicitly or by using ext4_update_i_disksize() helper. But the
      i_disksize updates in ext4_direct_IO_write() are not protected at all,
      which may be racing with i_disksize updates in writeback path in
      delalloc buffer write path.
      
      This is found by code inspection, and I didn't hit any i_disksize
      corruption due to this bug. Thanks to Jan Kara for catching this bug and
      suggesting the fix!
      Reported-by: NJan Kara <jack@suse.cz>
      Suggested-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      73fdad00
  5. 20 2月, 2018 1 次提交
    • T
      ext4: don't update checksum of new initialized bitmaps · 044e6e3d
      Theodore Ts'o 提交于
      When reading the inode or block allocation bitmap, if the bitmap needs
      to be initialized, do not update the checksum in the block group
      descriptor.  That's because we're not set up to journal those changes.
      Instead, just set the verified bit on the bitmap block, so that it's
      not necessary to validate the checksum.
      
      When a block or inode allocation actually happens, at that point the
      checksum will be calculated, and update of the bg descriptor block
      will be properly journalled.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      044e6e3d
  6. 19 2月, 2018 4 次提交
  7. 01 2月, 2018 1 次提交
  8. 29 1月, 2018 2 次提交
  9. 20 1月, 2018 1 次提交
    • D
      ext4: auto disable dax instead of failing mount · 24f3478d
      Dan Williams 提交于
      Bring the ext4 filesystem in line with xfs that only warns and continues
      when the "-o dax" option is specified to mount and the backing device
      does not support dax. This is in preparation for removing dax support
      from devices that do not enable get_user_pages() operations on dax
      mappings. In other words 'gup' support is required and configurations
      that were using so called 'page-less' dax will be converted back to
      using the page cache.
      
      Removing the broken 'page-less' dax support is a pre-requisite for
      removing the "EXPERIMENTAL" warning when mounting a filesystem in dax
      mode.
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      24f3478d
  10. 16 1月, 2018 1 次提交
    • D
      ext4: Define usercopy region in ext4_inode_cache slab cache · f8dd7c70
      David Windsor 提交于
      The ext4 symlink pathnames, stored in struct ext4_inode_info.i_data
      and therefore contained in the ext4_inode_cache slab cache, need
      to be copied to/from userspace.
      
      cache object allocation:
          fs/ext4/super.c:
              ext4_alloc_inode(...):
                  struct ext4_inode_info *ei;
                  ...
                  ei = kmem_cache_alloc(ext4_inode_cachep, GFP_NOFS);
                  ...
                  return &ei->vfs_inode;
      
          include/trace/events/ext4.h:
                  #define EXT4_I(inode) \
                      (container_of(inode, struct ext4_inode_info, vfs_inode))
      
          fs/ext4/namei.c:
              ext4_symlink(...):
                  ...
                  inode->i_link = (char *)&EXT4_I(inode)->i_data;
      
      example usage trace:
          readlink_copy+0x43/0x70
          vfs_readlink+0x62/0x110
          SyS_readlinkat+0x100/0x130
      
          fs/namei.c:
              readlink_copy(..., link):
                  ...
                  copy_to_user(..., link, len)
      
              (inlined into vfs_readlink)
              generic_readlink(dentry, ...):
                  struct inode *inode = d_inode(dentry);
                  const char *link = inode->i_link;
                  ...
                  readlink_copy(..., link);
      
      In support of usercopy hardening, this patch defines a region in the
      ext4_inode_cache slab cache in which userspace copy operations are
      allowed.
      
      This region is known as the slab cache's usercopy region. Slab caches
      can now check that each dynamically sized copy operation involving
      cache-managed memory falls entirely within the slab's usercopy region.
      
      This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY
      whitelisting code in the last public patch of grsecurity/PaX based on my
      understanding of the code. Changes or omissions from the original code are
      mine and don't reflect the original grsecurity/PaX code.
      Signed-off-by: NDavid Windsor <dave@nullcore.net>
      [kees: adjust commit log, provide usage trace]
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: linux-ext4@vger.kernel.org
      Signed-off-by: NKees Cook <keescook@chromium.org>
      f8dd7c70
  11. 12 1月, 2018 8 次提交
  12. 10 1月, 2018 3 次提交
  13. 08 1月, 2018 3 次提交
  14. 02 1月, 2018 1 次提交
  15. 18 12月, 2017 1 次提交
    • T
      ext4: fix up remaining files with SPDX cleanups · f5166768
      Theodore Ts'o 提交于
      A number of ext4 source files were skipped due because their copyright
      permission statements didn't match the expected text used by the
      automated conversion utilities.  I've added SPDX tags for the rest.
      
      While looking at some of these files, I've noticed that we have quite
      a bit of variation on the licenses that were used --- in particular
      some of the Red Hat licenses on the jbd2 files use a GPL2+ license,
      and we have some files that have a LGPL-2.1 license (which was quite
      surprising).
      
      I've not attempted to do any license changes.  Even if it is perfectly
      legal to relicense to GPL 2.0-only for consistency's sake, that should
      be done with ext4 developer community discussion.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      
      f5166768
  16. 12 12月, 2017 1 次提交
    • C
      ext4: fix crash when a directory's i_size is too small · 9d5afec6
      Chandan Rajendra 提交于
      On a ppc64 machine, when mounting a fuzzed ext2 image (generated by
      fsfuzzer) the following call trace is seen,
      
      VFS: brelse: Trying to free free buffer
      WARNING: CPU: 1 PID: 6913 at /root/repos/linux/fs/buffer.c:1165 .__brelse.part.6+0x24/0x40
      .__brelse.part.6+0x20/0x40 (unreliable)
      .ext4_find_entry+0x384/0x4f0
      .ext4_lookup+0x84/0x250
      .lookup_slow+0xdc/0x230
      .walk_component+0x268/0x400
      .path_lookupat+0xec/0x2d0
      .filename_lookup+0x9c/0x1d0
      .vfs_statx+0x98/0x140
      .SyS_newfstatat+0x48/0x80
      system_call+0x58/0x6c
      
      This happens because the directory that ext4_find_entry() looks up has
      inode->i_size that is less than the block size of the filesystem. This
      causes 'nblocks' to have a value of zero. ext4_bread_batch() ends up not
      reading any of the directory file's blocks. This renders the entries in
      bh_use[] array to continue to have garbage data. buffer_uptodate() on
      bh_use[0] can then return a zero value upon which brelse() function is
      invoked.
      
      This commit fixes the bug by returning -ENOENT when the directory file
      has no associated blocks.
      Reported-by: NAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Signed-off-by: NChandan Rajendra <chandan@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org
      9d5afec6
  17. 11 12月, 2017 1 次提交
    • T
      ext4: add missing error check in __ext4_new_inode() · 996fc447
      Theodore Ts'o 提交于
      It's possible for ext4_get_acl() to return an ERR_PTR.  So we need to
      add a check for this case in __ext4_new_inode().  Otherwise on an
      error we can end up oops the kernel.
      
      This was getting triggered by xfstests generic/388, which is a test
      which exercises the shutdown code path.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      996fc447
  18. 04 12月, 2017 2 次提交
    • E
      ext4: fix fdatasync(2) after fallocate(2) operation · c894aa97
      Eryu Guan 提交于
      Currently, fallocate(2) with KEEP_SIZE followed by a fdatasync(2)
      then crash, we'll see wrong allocated block number (stat -c %b), the
      blocks allocated beyond EOF are all lost. fstests generic/468
      exposes this bug.
      
      Commit 67a7d5f5 ("ext4: fix fdatasync(2) after extent
      manipulation operations") fixed all the other extent manipulation
      operation paths such as hole punch, zero range, collapse range etc.,
      but forgot the fallocate case.
      
      So similarly, fix it by recording the correct journal tid in ext4
      inode in fallocate(2) path, so that ext4_sync_file() will wait for
      the right tid to be committed on fdatasync(2).
      
      This addresses the test failure in xfstests test generic/468.
      Signed-off-by: NEryu Guan <eguan@redhat.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      c894aa97
    • A
      ext4: support fast symlinks from ext3 file systems · fc82228a
      Andi Kleen 提交于
      407cd7fb (ext4: change fast symlink test to not rely on i_blocks)
      broke ~10 years old ext3 file systems created by 2.6.17. Any ELF
      executable fails because the /lib/ld-linux.so.2 fast symlink
      cannot be read anymore.
      
      The patch assumed fast symlinks were created in a specific way,
      but that's not true on these really old file systems.
      
      The new behavior is apparently needed only with the large EA inode
      feature.
      
      Revert to the old behavior if the large EA inode feature is not set.
      
      This makes my old VM boot again.
      
      Fixes: 407cd7fb (ext4: change fast symlink test to not rely on i_blocks)
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NAndreas Dilger <adilger@dilger.ca>
      Cc: stable@vger.kernel.org
      fc82228a