1. 27 Oct, 2011 1 commit
  2. 26 Oct, 2011 10 commits
  3. 25 Oct, 2011 3 commits
    • Darrick J. Wong's avatar
      ext4: prevent stack overrun in ext4_file_open · cf803903
      Darrick J. Wong authored
      In ext4_file_open, the filesystem records the mountpoint of the first
      file that is opened after mounting the filesystem.  It does this by
      allocating a 64-byte stack buffer, calling d_path() to grab the mount
      point through which this file was accessed, and then memcpy()ing 64
      bytes into the superblock's s_last_mounted field, starting from the
      return value of d_path(), which is stored as "cp".  However, if cp >
      buf (which it frequently is since path components are prepended
      starting at the end of buf) then we can end up copying stack data into
      the superblock.
      
      Writing stack variables into the superblock doesn't sound like a great
      idea, so use strlcpy instead.  Andi Kleen suggested using strlcpy
      instead of strncpy.
      Signed-off-by: default avatarDarrick J. Wong <djwong@us.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      cf803903
    • Dmitry Monakhov's avatar
      ext4: update EOFBLOCKS flag on fallocate properly · a4e5d88b
      Dmitry Monakhov authored
      EOFBLOCK_FL should be updated if called w/o FALLOCATE_FL_KEEP_SIZE
      Currently it happens only if new extent was allocated.
      
      TESTCASE:
      fallocate test_file -n -l4096
      fallocate test_file -l4096
      Last fallocate cmd has updated size, but keept EOFBLOCK_FL set. And
      fsck will complain about that.
      
      Also remove ping pong in ext4_fallocate() in case of new extents,
      where ext4_ext_map_blocks() clear EOFBLOCKS bit, and later
      ext4_falloc_update_inode() restore it again.
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      a4e5d88b
    • Dmitry Monakhov's avatar
      ext4: remove messy logic from ext4_ext_rm_leaf · 750c9c47
      Dmitry Monakhov authored
      - Both callers(truncate and punch_hole) already aligned left end point
        so we no longer need split logic here.
      - Remove dead duplicated code.
      - Call ext4_ext_dirty only after we have updated eh_entries, otherwise
        we'll loose entries update. Regression caused by d583fb87
        266'th testcase in xfstests (http://patchwork.ozlabs.org/patch/120872)
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      750c9c47
  4. 22 Oct, 2011 1 commit
    • Dmitry Monakhov's avatar
      ext4: cleanup ext4_ext_grow_indepth code · 1939dd84
      Dmitry Monakhov authored
      Currently code make an impression what grow procedure is very complicated
      and some mythical paths, blocks are involved. But in fact grow in depth
      it relatively simple procedure:
       1) Just create new meta block and copy root data to that block.
       2) Convert root from extent to index if old depth == 0
       3) Update root block pointer
      
      This patch does:
       - Reorganize code to make it more self explanatory
       - Do not pass path parameter to new_meta_block() in order to
         provoke allocation from inode's group because top-level block
         should site closer to it's inode, but not to leaf data block.
      
         [ This happens anyway, due to logic in mballoc; we should drop
           the path parameter from new_meta_block() entirely.  -- tytso ]
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      1939dd84
  5. 21 Oct, 2011 1 commit
  6. 20 Oct, 2011 2 commits
  7. 18 Oct, 2011 7 commits
  8. 17 Oct, 2011 1 commit
  9. 08 Oct, 2011 6 commits
  10. 06 Oct, 2011 2 commits
  11. 09 Sep, 2011 6 commits
    • Aditya Kali's avatar
      ext4: attempt to fix race in bigalloc code path · 5356f261
      Aditya Kali authored
      Currently, there exists a race between delayed allocated writes and
      the writeback when bigalloc feature is in use. The race was because we
      wanted to determine what blocks in a cluster are under delayed
      allocation and we were using buffer_delayed(bh) check for it. But, the
      writeback codepath clears this bit without any synchronization which
      resulted in a race and an ext4 warning similar to:
      
      EXT4-fs (ram1): ext4_da_update_reserve_space: ino 13, used 1 with only 0
      		reserved data blocks
      
      The race existed in two places.
      (1) between ext4_find_delalloc_range() and ext4_map_blocks() when called from
          writeback code path.
      (2) between ext4_find_delalloc_range() and ext4_da_get_block_prep() (where
          buffer_delayed(bh) is set.
      
      To fix (1), this patch introduces a new buffer_head state bit -
      BH_Da_Mapped.  This bit is set under the protection of
      EXT4_I(inode)->i_data_sem when we have actually mapped the delayed
      allocated blocks during the writeout time. We can now reliably check
      for this bit inside ext4_find_delalloc_range() to determine whether
      the reservation for the blocks have already been claimed or not.
      
      To fix (2), it was necessary to set buffer_delay(bh) under the
      protection of i_data_sem.  So, I extracted the very beginning of
      ext4_map_blocks into a new function - ext4_da_map_blocks() - and
      performed the required setting of bh_delay bit and the quota
      reservation under the protection of i_data_sem.  These two fixes makes
      the checking of buffer_delay(bh) and buffer_da_mapped(bh) consistent,
      thus removing the race.
      
      Tested: I was able to reproduce the problem by running 'dd' and
      'fsync' in parallel. Also, xfstests sometimes used to reproduce this
      race. After the fix both my test and xfstests were successful and no
      race (warning message) was observed.
      
      Google-Bug-Id: 4997027
      Signed-off-by: default avatarAditya Kali <adityakali@google.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      5356f261
    • Aditya Kali's avatar
      ext4: add some tracepoints in ext4/extents.c · d8990240
      Aditya Kali authored
      This patch adds some tracepoints in ext4/extents.c and updates a tracepoint in
      ext4/inode.c.
      
      Tested: Built and ran the kernel and verified that these tracepoints work.
      Also ran xfstests.
      Signed-off-by: default avatarAditya Kali <adityakali@google.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
          
      d8990240
    • Theodore Ts'o's avatar
      ext4: rename ext4_has_free_blocks() to ext4_has_free_clusters() · df55c99d
      Theodore Ts'o authored
      Rename the function so it is more clear what is going on.  Also rename
      the various variables so it's clearer what's happening.
      
      Also fix a missing blocks to cluster conversion when reading the
      number of reserved blocks for root.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      df55c99d
    • Theodore Ts'o's avatar
      ext4: rename ext4_claim_free_blocks() to ext4_claim_free_clusters() · e7d5f315
      Theodore Ts'o authored
      This function really claims a number of free clusters, not blocks, so
      rename it so it's clearer what's going on.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      e7d5f315
    • Theodore Ts'o's avatar
      ext4: rename ext4_free_blocks_after_init() to ext4_free_clusters_after_init() · cff1dfd7
      Theodore Ts'o authored
      This function really returns the number of clusters after initializing
      an uninitalized block bitmap has been initialized.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      cff1dfd7
    • Theodore Ts'o's avatar
      ext4: rename ext4_count_free_blocks() to ext4_count_free_clusters() · 5dee5437
      Theodore Ts'o authored
      This function really counts the free clusters reported in the block
      group descriptors, so rename it to reduce confusion.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      5dee5437