1. 05 1月, 2019 1 次提交
  2. 01 1月, 2019 1 次提交
  3. 31 12月, 2018 3 次提交
    • T
      ext4: track writeback errors using the generic tracking infrastructure · 95cb6713
      Theodore Ts'o 提交于
      We already using mapping_set_error() in fs/ext4/page_io.c, so all we
      need to do is to use file_check_and_advance_wb_err() when handling
      fsync() requests in ext4_sync_file().
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      95cb6713
    • T
      ext4: use ext4_write_inode() when fsyncing w/o a journal · ad211f3e
      Theodore Ts'o 提交于
      In no-journal mode, we previously used __generic_file_fsync() in
      no-journal mode.  This triggers a lockdep warning, and in addition,
      it's not safe to depend on the inode writeback mechanism in the case
      ext4.  We can solve both problems by calling ext4_write_inode()
      directly.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      ad211f3e
    • T
      ext4: avoid kernel warning when writing the superblock to a dead device · e8680786
      Theodore Ts'o 提交于
      The xfstests generic/475 test switches the underlying device with
      dm-error while running a stress test.  This results in a large number
      of file system errors, and since we can't lock the buffer head when
      marking the superblock dirty in the ext4_grp_locked_error() case, it's
      possible the superblock to be !buffer_uptodate() without
      buffer_write_io_error() being true.
      
      We need to set buffer_uptodate() before we call mark_buffer_dirty() or
      this will trigger a WARN_ON.  It's safe to do this since the
      superblock must have been properly read into memory or the mount would
      have been successful.  So if buffer_uptodate() is not set, we can
      safely assume that this happened due to a failed attempt to write the
      superblock.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      e8680786
  4. 25 12月, 2018 2 次提交
    • T
      ext4: fix a potential fiemap/page fault deadlock w/ inline_data · 2b08b1f1
      Theodore Ts'o 提交于
      The ext4_inline_data_fiemap() function calls fiemap_fill_next_extent()
      while still holding the xattr semaphore.  This is not necessary and it
      triggers a circular lockdep warning.  This is because
      fiemap_fill_next_extent() could trigger a page fault when it writes
      into page which triggers a page fault.  If that page is mmaped from
      the inline file in question, this could very well result in a
      deadlock.
      
      This problem can be reproduced using generic/519 with a file system
      configuration which has the inline_data feature enabled.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      2b08b1f1
    • T
      ext4: make sure enough credits are reserved for dioread_nolock writes · 812c0cab
      Theodore Ts'o 提交于
      There are enough credits reserved for most dioread_nolock writes;
      however, if the extent tree is sufficiently deep, and/or quota is
      enabled, the code was not allowing for all eventualities when
      reserving journal credits for the unwritten extent conversion.
      
      This problem can be seen using xfstests ext4/034:
      
         WARNING: CPU: 1 PID: 257 at fs/ext4/ext4_jbd2.c:271 __ext4_handle_dirty_metadata+0x10c/0x180
         Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work
         RIP: 0010:__ext4_handle_dirty_metadata+0x10c/0x180
         	...
         EXT4-fs: ext4_free_blocks:4938: aborting transaction: error 28 in __ext4_handle_dirty_metadata
         EXT4: jbd2_journal_dirty_metadata failed: handle type 11 started at line 4921, credits 4/0, errcode -28
         EXT4-fs error (device dm-1) in ext4_free_blocks:4950: error 28
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      812c0cab
  5. 20 12月, 2018 4 次提交
    • T
      ext4: check for shutdown and r/o file system in ext4_write_inode() · 18f2c4fc
      Theodore Ts'o 提交于
      If the file system has been shut down or is read-only, then
      ext4_write_inode() needs to bail out early.
      
      Also use jbd2_complete_transaction() instead of ext4_force_commit() so
      we only force a commit if it is needed.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      18f2c4fc
    • T
      ext4: force inode writes when nfsd calls commit_metadata() · fde87268
      Theodore Ts'o 提交于
      Some time back, nfsd switched from calling vfs_fsync() to using a new
      commit_metadata() hook in export_operations().  If the file system did
      not provide a commit_metadata() hook, it fell back to using
      sync_inode_metadata().  Unfortunately doesn't work on all file
      systems.  In particular, it doesn't work on ext4 due to how the inode
      gets journalled --- the VFS writeback code will not always call
      ext4_write_inode().
      
      So we need to provide our own ext4_nfs_commit_metdata() method which
      calls ext4_write_inode() directly.
      
      Google-Bug-Id: 121195940
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      fde87268
    • T
      ext4: avoid declaring fs inconsistent due to invalid file handles · 8a363970
      Theodore Ts'o 提交于
      If we receive a file handle, either from NFS or open_by_handle_at(2),
      and it points at an inode which has not been initialized, and the file
      system has metadata checksums enabled, we shouldn't try to get the
      inode, discover the checksum is invalid, and then declare the file
      system as being inconsistent.
      
      This can be reproduced by creating a test file system via "mke2fs -t
      ext4 -O metadata_csum /tmp/foo.img 8M", mounting it, cd'ing into that
      directory, and then running the following program.
      
      #define _GNU_SOURCE
      #include <fcntl.h>
      
      struct handle {
      	struct file_handle fh;
      	unsigned char fid[MAX_HANDLE_SZ];
      };
      
      int main(int argc, char **argv)
      {
      	struct handle h = {{8, 1 }, { 12, }};
      
      	open_by_handle_at(AT_FDCWD, &h.fh, O_RDONLY);
      	return 0;
      }
      
      Google-Bug-Id: 120690101
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      8a363970
    • T
      ext4: include terminating u32 in size of xattr entries when expanding inodes · a805622a
      Theodore Ts'o 提交于
      In ext4_expand_extra_isize_ea(), we calculate the total size of the
      xattr header, plus the xattr entries so we know how much of the
      beginning part of the xattrs to move when expanding the inode extra
      size.  We need to include the terminating u32 at the end of the xattr
      entries, or else if there is uninitialized, non-zero bytes after the
      xattr entries and before the xattr values, the list of xattr entries
      won't be properly terminated.
      Reported-by: NSteve Graham <stgraham2000@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      a805622a
  6. 10 12月, 2018 1 次提交
  7. 08 12月, 2018 1 次提交
  8. 04 12月, 2018 6 次提交
  9. 26 11月, 2018 1 次提交
    • T
      ext4: add ext4_sb_bread() to disambiguate ENOMEM cases · fb265c9c
      Theodore Ts'o 提交于
      Today, when sb_bread() returns NULL, this can either be because of an
      I/O error or because the system failed to allocate the buffer.  Since
      it's an old interface, changing would require changing many call
      sites.
      
      So instead we create our own ext4_sb_bread(), which also allows us to
      set the REQ_META flag.
      
      Also fixed a problem in the xattr code where a NULL return in a
      function could also mean that the xattr was not found, which could
      lead to the wrong error getting returned to userspace.
      
      Fixes: ac27a0ec ("ext4: initial copy of files from ext3")
      Cc: stable@kernel.org # 2.6.19
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      fb265c9c
  10. 10 11月, 2018 1 次提交
    • V
      ext4: missing !bh check in ext4_xattr_inode_write() · eb6984fa
      Vasily Averin 提交于
      According to Ted Ts'o ext4_getblk() called in ext4_xattr_inode_write()
      should not return bh = NULL
      
      The only time that bh could be NULL, then, would be in the case of
      something really going wrong; a programming error elsewhere (perhaps a
      wild pointer dereference) or I/O error causing on-disk file system
      corruption (although that would be highly unlikely given that we had
      *just* allocated the blocks and so the metadata blocks in question
      probably would still be in the cache).
      
      Fixes: e50e5129 ("ext4: xattr-in-inode support")
      Signed-off-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org # 4.13
      eb6984fa
  11. 08 11月, 2018 5 次提交
  12. 07 11月, 2018 8 次提交
  13. 04 11月, 2018 4 次提交
  14. 02 11月, 2018 1 次提交
  15. 21 10月, 2018 1 次提交