1. 11 Apr, 2011 2 commits
    • Yongqiang Yang's avatar
      ext4: allow an active handle to be started when freezing · be4f27d3
      Yongqiang Yang authored
      ext4_journal_start_sb() should not prevent an active handle from being
      started due to s_frozen.  Otherwise, deadlock is easy to happen, below
      is a situation.
      
      ================================================
           freeze         |       truncate
      ================================================
                          |  ext4_ext_truncate()
          freeze_super()  |   starts a handle
          sets s_frozen   |
                          |  ext4_ext_truncate()
                          |  holds i_data_sem
        ext4_freeze()     |
        waits for updates |
                          |  ext4_free_blocks()
                          |  calls dquot_free_block()
                          |
                          |  dquot_free_blocks()
                          |  calls ext4_dirty_inode()
                          |
                          |  ext4_dirty_inode()
                          |  trys to start an active
                          |  handle
                          |
                          |  block due to s_frozen
      ================================================
      Signed-off-by: default avatarYongqiang Yang <xiaoqiangnk@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reported-by: default avatarAmir Goldstein <amir73il@users.sf.net>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      be4f27d3
    • Curt Wohlgemuth's avatar
      ext4: sync the directory inode in ext4_sync_parent() · 0893ed45
      Curt Wohlgemuth authored
      ext4 has taken the stance that, in the absence of a journal,
      when an fsync/fdatasync of an inode is done, the parent
      directory should be sync'ed if this inode entry is new.
      ext4_sync_parent(), which implements this, does indeed sync
      the dirent pages for parent directories, but it does not
      sync the directory *inode*.  This patch fixes this.
      
      Also now return error status from ext4_sync_parent().
      
      I tested this using a power fail test, which panics a
      machine running a file server getting requests from a
      client.  Without this patch, on about every other test run,
      the server is missing many, many files that had been synced.
      With this patch, on > 6 runs, I see zero files being lost.
      
      Google-Bug-Id: 4179519
      Signed-off-by: default avatarCurt Wohlgemuth <curtw@google.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      0893ed45
  2. 05 Apr, 2011 2 commits
    • Tao Ma's avatar
      ext4: init timer earlier to avoid a kernel panic in __save_error_info · 04496411
      Tao Ma authored
      During mount, when we fail to open journal inode or root inode, the
      __save_error_info will mod_timer. But actually s_err_report isn't
      initialized yet and the kernel oops. The detailed information can
      be found https://bugzilla.kernel.org/show_bug.cgi?id=32082.
      
      The best way is to check whether the timer s_err_report is initialized
      or not. But it seems that in include/linux/timer.h, we can't find a
      good function to check the status of this timer, so this patch just
      move the initializtion of s_err_report earlier so that we can avoid
      the kernel panic. The corresponding del_timer is also added in the
      error path.
      Reported-by: default avatarSami Liedes <sliedes@cc.hut.fi>
      Signed-off-by: default avatarTao Ma <boyu.mt@taobao.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      04496411
    • Zhang Huan's avatar
      jbd2: fix potential memory leak on transaction commit · 6cba611e
      Zhang Huan authored
      There is potential memory leak of journal head in function
      jbd2_journal_commit_transaction. The problem is that JBD2 will not
      reclaim the journal head of commit record if error occurs or journal
      is abotred.
      
      I use the following script to reproduce this issue, on a RHEL6
      system. I found it very easy to reproduce with async commit enabled.
      
      mount /dev/sdb /mnt -o journal_checksum,journal_async_commit
      touch /mnt/xxx
      echo offline > /sys/block/sdb/device/state
      sync
      umount /mnt
      rmmod ext4
      rmmod jbd2
      
      Removal of the jbd2 module will make slab complaining that
      "cache `jbd2_journal_head': can't free all objects".
      Signed-off-by: default avatarZhang Huan <zhhuan@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      6cba611e
  3. 04 Apr, 2011 4 commits
  4. 29 Mar, 2011 32 commits