1. 18 Dec, 2009 29 commits
  2. 14 Dec, 2009 11 commits
    • Greg Kroah-Hartman's avatar
      Linux 2.6.32.1 · acb34e4d
      Greg Kroah-Hartman authored
      acb34e4d
    • Theodore Ts'o's avatar
      ext4: Fix potential fiemap deadlock (mmap_sem vs. i_data_sem) · abb24706
      Theodore Ts'o authored
      (cherry picked from commit fab3a549)
      
      Fix the following potential circular locking dependency between
      mm->mmap_sem and ei->i_data_sem:
      
          =======================================================
          [ INFO: possible circular locking dependency detected ]
          2.6.32-04115-gec044c5 #37
          -------------------------------------------------------
          ureadahead/1855 is trying to acquire lock:
           (&mm->mmap_sem){++++++}, at: [<ffffffff81107224>] might_fault+0x5c/0xac
      
          but task is already holding lock:
           (&ei->i_data_sem){++++..}, at: [<ffffffff811be1fd>] ext4_fiemap+0x11b/0x159
      
          which lock already depends on the new lock.
      
          the existing dependency chain (in reverse order) is:
      
          -> #1 (&ei->i_data_sem){++++..}:
                 [<ffffffff81099bfa>] __lock_acquire+0xb67/0xd0f
                 [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
                 [<ffffffff81516633>] down_read+0x51/0x84
                 [<ffffffff811a2414>] ext4_get_blocks+0x50/0x2a5
                 [<ffffffff811a3453>] ext4_get_block+0xab/0xef
                 [<ffffffff81154f39>] do_mpage_readpage+0x198/0x48d
                 [<ffffffff81155360>] mpage_readpages+0xd0/0x114
                 [<ffffffff811a104b>] ext4_readpages+0x1d/0x1f
                 [<ffffffff810f8644>] __do_page_cache_readahead+0x12f/0x1bc
                 [<ffffffff810f86f2>] ra_submit+0x21/0x25
                 [<ffffffff810f0cfd>] filemap_fault+0x19f/0x32c
                 [<ffffffff81107b97>] __do_fault+0x55/0x3a2
                 [<ffffffff81109db0>] handle_mm_fault+0x327/0x734
                 [<ffffffff8151aaa9>] do_page_fault+0x292/0x2aa
                 [<ffffffff81518205>] page_fault+0x25/0x30
                 [<ffffffff812a34d8>] clear_user+0x38/0x3c
                 [<ffffffff81167e16>] padzero+0x20/0x31
                 [<ffffffff81168b47>] load_elf_binary+0x8bc/0x17ed
                 [<ffffffff81130e95>] search_binary_handler+0xc2/0x259
                 [<ffffffff81166d64>] load_script+0x1b8/0x1cc
                 [<ffffffff81130e95>] search_binary_handler+0xc2/0x259
                 [<ffffffff8113255f>] do_execve+0x1ce/0x2cf
                 [<ffffffff81027494>] sys_execve+0x43/0x5a
                 [<ffffffff8102918a>] stub_execve+0x6a/0xc0
      
          -> #0 (&mm->mmap_sem){++++++}:
                 [<ffffffff81099aa4>] __lock_acquire+0xa11/0xd0f
                 [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
                 [<ffffffff81107251>] might_fault+0x89/0xac
                 [<ffffffff81139382>] fiemap_fill_next_extent+0x95/0xda
                 [<ffffffff811bcb43>] ext4_ext_fiemap_cb+0x138/0x157
                 [<ffffffff811be069>] ext4_ext_walk_space+0x178/0x1f1
                 [<ffffffff811be21e>] ext4_fiemap+0x13c/0x159
                 [<ffffffff811390e6>] do_vfs_ioctl+0x348/0x4d6
                 [<ffffffff811392ca>] sys_ioctl+0x56/0x79
                 [<ffffffff81028cb2>] system_call_fastpath+0x16/0x1b
      
          other info that might help us debug this:
      
          1 lock held by ureadahead/1855:
           #0:  (&ei->i_data_sem){++++..}, at: [<ffffffff811be1fd>] ext4_fiemap+0x11b/0x159
      
          stack backtrace:
          Pid: 1855, comm: ureadahead Not tainted 2.6.32-04115-gec044c5 #37
          Call Trace:
           [<ffffffff81098c70>] print_circular_bug+0xa8/0xb7
           [<ffffffff81099aa4>] __lock_acquire+0xa11/0xd0f
           [<ffffffff8102f229>] ? sched_clock+0x9/0xd
           [<ffffffff81099e7e>] lock_acquire+0xdc/0x102
           [<ffffffff81107224>] ? might_fault+0x5c/0xac
           [<ffffffff81107251>] might_fault+0x89/0xac
           [<ffffffff81107224>] ? might_fault+0x5c/0xac
           [<ffffffff81124b44>] ? __kmalloc+0x13b/0x18c
           [<ffffffff81139382>] fiemap_fill_next_extent+0x95/0xda
           [<ffffffff811bcb43>] ext4_ext_fiemap_cb+0x138/0x157
           [<ffffffff811bca0b>] ? ext4_ext_fiemap_cb+0x0/0x157
           [<ffffffff811be069>] ext4_ext_walk_space+0x178/0x1f1
           [<ffffffff811be21e>] ext4_fiemap+0x13c/0x159
           [<ffffffff81107224>] ? might_fault+0x5c/0xac
           [<ffffffff811390e6>] do_vfs_ioctl+0x348/0x4d6
           [<ffffffff8129f6d0>] ? __up_read+0x8d/0x95
           [<ffffffff81517fb5>] ? retint_swapgs+0x13/0x1b
           [<ffffffff811392ca>] sys_ioctl+0x56/0x79
           [<ffffffff81028cb2>] system_call_fastpath+0x16/0x1b
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      abb24706
    • Akira Fujita's avatar
      ext4: Fix insufficient checks in EXT4_IOC_MOVE_EXT · 0fd023ec
      Akira Fujita authored
      (cherry picked from commit 4a58579b)
      
      This patch fixes three problems in the handling of the
      EXT4_IOC_MOVE_EXT ioctl:
      
      1. In current EXT4_IOC_MOVE_EXT, there are read access mode checks for
      original and donor files, but they allow the illegal write access to
      donor file, since donor file is overwritten by original file data.  To
      fix this problem, change access mode checks of original (r->r/w) and
      donor (r->w) files.
      
      2.  Disallow the use of donor files that have a setuid or setgid bits.
      
      3.  Call mnt_want_write() and mnt_drop_write() before and after
      ext4_move_extents() calling to get write access to a mount.
      Signed-off-by: default avatarAkira Fujita <a-fujita@rs.jp.nec.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0fd023ec
    • Jan Kara's avatar
      ext4: Wait for proper transaction commit on fsync · eebb744d
      Jan Kara authored
      (cherry picked from commit b436b9be)
      
      We cannot rely on buffer dirty bits during fsync because pdflush can come
      before fsync is called and clear dirty bits without forcing a transaction
      commit. What we do is that we track which transaction has last changed
      the inode and which transaction last changed allocation and force it to
      disk on fsync.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      eebb744d
    • Dmitry Monakhov's avatar
      ext4: fix incorrect block reservation on quota transfer. · caa305aa
      Dmitry Monakhov authored
      (cherry picked from commit 194074ac)
      
      Inside ->setattr() call both ATTR_UID and ATTR_GID may be valid
      This means that we may end-up with transferring all quotas. Add
      we have to reserve QUOTA_DEL_BLOCKS for all quotas, as we do in
      case of QUOTA_INIT_BLOCKS.
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Reviewed-by: default avatarMingming Cao <cmm@us.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      caa305aa
    • Dmitry Monakhov's avatar
      ext4: quota macros cleanup · da2068b3
      Dmitry Monakhov authored
      (cherry picked from commit 5aca07eb)
      
      Currently all quota block reservation macros contains hard-coded "2"
      aka MAXQUOTAS value. This is no good because in some places it is not
      obvious to understand what does this digit represent. Let's introduce
      new macro with self descriptive name.
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Acked-by: default avatarMingming Cao <cmm@us.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      da2068b3
    • Dmitry Monakhov's avatar
      6798788a
    • Curt Wohlgemuth's avatar
      ext4: remove blocks from inode prealloc list on failure · 637b1310
      Curt Wohlgemuth authored
      (cherry picked from commit b844167e)
      
      This fixes a leak of blocks in an inode prealloc list if device failures
      cause ext4_mb_mark_diskspace_used() to fail.
      Signed-off-by: default avatarCurt Wohlgemuth <curtw@google.com>
      Acked-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      637b1310
    • Josef Bacik's avatar
      ext4: wait for log to commit when umounting · 1cd3f198
      Josef Bacik authored
      (cherry picked from commit d4edac31)
      
      There is a potential race when a transaction is committing right when
      the file system is being umounting.  This could reduce in a race
      because EXT4_SB(sb)->s_group_info could be freed in ext4_put_super
      before the commit code calls a callback so the mballoc code can
      release freed blocks in the transaction, resulting in a panic trying
      to access the freed s_group_info.
      
      The fix is to wait for the transaction to finish committing before we
      shutdown the multiblock allocator.
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1cd3f198
    • Jan Kara's avatar
      ext4: Avoid data / filesystem corruption when write fails to copy data · 35a6f782
      Jan Kara authored
      (cherry picked from commit b9a4207d)
      
      When ext4_write_begin fails after allocating some blocks or
      generic_perform_write fails to copy data to write, we truncate blocks
      already instantiated beyond i_size.  Although these blocks were never
      inside i_size, we have to truncate the pagecache of these blocks so
      that corresponding buffers get unmapped.  Otherwise subsequent
      __block_prepare_write (called because we are retrying the write) will
      find the buffers mapped, not call ->get_block, and thus the page will
      be backed by already freed blocks leading to filesystem and data
      corruption.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      35a6f782
    • Roel Kluin's avatar
      ext4: Return the PTR_ERR of the correct pointer in setup_new_group_blocks() · 66c3a718
      Roel Kluin authored
      (cherry picked from commit c09eef30)
      Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      66c3a718