1. 23 11月, 2009 2 次提交
    • A
      ext4: fix lock order problem in ext4_move_extents() · fc04cb49
      Akira Fujita 提交于
      ext4_move_extents() checks the logical block contiguousness
      of original file with ext4_find_extent() and mext_next_extent().
      Therefore the extent which ext4_ext_path structure indicates
      must not be changed between above functions.
      
      But in current implementation, there is no i_data_sem protection
      between ext4_ext_find_extent() and mext_next_extent().  So the extent
      which ext4_ext_path structure indicates may be overwritten by
      delalloc.  As a result, ext4_move_extents() will exchange wrong blocks
      between original and donor files.  I change the place where
      acquire/release i_data_sem to solve this problem.
      
      Moreover, I changed move_extent_per_page() to start transaction first,
      and then acquire i_data_sem.  Without this change, there is a
      possibility of the deadlock between mmap() and ext4_move_extents():
      
      * NOTE: "A", "B" and "C" mean different processes
      
      A-1: ext4_ext_move_extents() acquires i_data_sem of two inodes.
      
      B:   do_page_fault() starts the transaction (T),
           and then tries to acquire i_data_sem.
           But process "A" is already holding it, so it is kept waiting.
      
      C:   While "A" and "B" running, kjournald2 tries to commit transaction (T)
           but it is under updating, so kjournald2 waits for it.
      
      A-2: Call ext4_journal_start with holding i_data_sem,
           but transaction (T) is locked.
      Signed-off-by: NAkira Fujita <a-fujita@rs.jp.nec.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      fc04cb49
    • A
      ext4: fix the returned block count if EXT4_IOC_MOVE_EXT fails · f868a48d
      Akira Fujita 提交于
      If the EXT4_IOC_MOVE_EXT ioctl fails, the number of blocks that were
      exchanged before the failure should be returned to the userspace
      caller.  Unfortunately, currently if the block size is not the same as
      the page size, the returned block count that is returned is the
      page-aligned block count instead of the actual block count.  This
      commit addresses this bug.
      Signed-off-by: NAkira Fujita <a-fujita@rs.jp.nec.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      f868a48d
  2. 29 9月, 2009 2 次提交
  3. 17 9月, 2009 5 次提交
  4. 06 9月, 2009 2 次提交
  5. 17 9月, 2009 1 次提交
  6. 11 8月, 2009 1 次提交
    • P
      ext4: fix journal ref count in move_extent_par_page · 91cc219a
      Peng Tao 提交于
      move_extent_par_page calls a_ops->write_begin() to increase journal
      handler's reference count. However, if either mext_replace_branches()
      or ext4_get_block fails, the increased reference count isn't
      decreased. This will cause a later attempt to umount of the fs to hang
      forever. The patch addresses the issue by calling ext4_journal_stop()
      if page is not NULL (which means a_ops->write_end() isn't invoked).
      Signed-off-by: NPeng Tao <bergwolf@gmail.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      91cc219a
  7. 18 6月, 2009 1 次提交