1. 05 Feb, 2013 1 commit
    • Josef Bacik's avatar
      Btrfs: do not merge logged extents if we've removed them from the tree · 222c81dc
      Josef Bacik authored
      You can run into this problem where if somebody is fsyncing and writing out
      the existing extents you will have removed the extent map from the em tree,
      but it's still valid for the current fsync so we go ahead and write it.  The
      problem is we unconditionally try to merge it back into the em tree, but if
      we've removed it from the em tree that will cause use after free problems.
      Fix this to only merge if we are still a part of the tree.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      222c81dc
  2. 24 Jan, 2013 8 commits
  3. 22 Jan, 2013 5 commits
  4. 20 Jan, 2013 5 commits
  5. 14 Jan, 2013 14 commits
  6. 19 Dec, 2012 1 commit
  7. 18 Dec, 2012 1 commit
  8. 17 Dec, 2012 5 commits
    • Liu Bo's avatar
      Btrfs: fix a bug of per-file nocow · 213490b3
      Liu Bo authored
      Users report a bug, the reproducer is:
      $ mkfs.btrfs /dev/loop0
      $ mount /dev/loop0 /mnt/btrfs/
      $ mkdir /mnt/btrfs/dir
      $ chattr +C /mnt/btrfs/dir/
      $ dd if=/dev/zero of=/mnt/btrfs/dir/foo bs=4K count=10;
      $ lsattr /mnt/btrfs/dir/foo
      ---------------C- /mnt/btrfs/dir/foo
      $ filefrag /mnt/btrfs/dir/foo
      /mnt/btrfs/dir/foo: 1 extent found    ---> an extent
      $ dd if=/dev/zero of=/mnt/btrfs/dir/foo bs=4K count=1 seek=5 conv=notrunc,nocreat; sync
      $ filefrag /mnt/btrfs/dir/foo
      /mnt/btrfs/dir/foo: 3 extents found   ---> with nocow, btrfs breaks the extent into three parts
      
      The new created file should not only inherit the NODATACOW flag, but also
      honor NODATASUM flag, because we must do COW on a file extent with checksum.
      Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      213490b3
    • Chris Mason's avatar
      Btrfs: fix hash overflow handling · 9c52057c
      Chris Mason authored
      The handling for directory crc hash overflows was fairly obscure,
      split_leaf returns EOVERFLOW when we try to extend the item and that is
      supposed to bubble up to userland.  For a while it did so, but along the
      way we added better handling of errors and forced the FS readonly if we
      hit IO errors during the directory insertion.
      
      Along the way, we started testing only for EEXIST and the EOVERFLOW case
      was dropped.  The end result is that we may force the FS readonly if we
      catch a directory hash bucket overflow.
      
      This fixes a few problem spots.  First I add tests for EOVERFLOW in the
      places where we can safely just return the error up the chain.
      
      btrfs_rename is harder though, because it tries to insert the new
      directory item only after it has already unlinked anything the rename
      was going to overwrite.  Rather than adding very complex logic, I added
      a helper to test for the hash overflow case early while it is still safe
      to bail out.
      
      Snapshot and subvolume creation had a similar problem, so they are using
      the new helper now too.
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      Reported-by: default avatarPascal Junod <pascal@junod.info>
      9c52057c
    • Josef Bacik's avatar
      Btrfs: don't take inode delalloc mutex if we're a free space inode · c64c2bd8
      Josef Bacik authored
      This confuses and angers lockdep even though it's ok.  We don't really need
      the lock for free space inodes since only the transaction committer will be
      reserving space.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      c64c2bd8
    • Josef Bacik's avatar
      Btrfs: fix autodefrag and umount lockup · 1135d6df
      Josef Bacik authored
      This happens because writeback_inodes_sb_nr_if_idle does down_read.  This
      doesn't work for us and it has not been fixed upstream yet, so do it
      ourselves and use that instead so we can stop having this stupid long
      standing lockup.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      1135d6df
    • Filipe Brandenburger's avatar
      Btrfs: fix permissions of empty files not affected by umask · 9185aa58
      Filipe Brandenburger authored
      When a new file is created with btrfs_create(), the inode will initially be
      created with permissions 0666 and later on in btrfs_init_acl() it will be
      adapted to mask out the umask bits. The problem is that this change won't make
      it into the btrfs_inode unless there's another change to the inode (e.g. writing
      content changing the size or touching the file changing the mtime.)
      
      This fix adds a call to btrfs_update_inode() to btrfs_create() to make sure that
      the change will not get lost if the in-memory inode is flushed before other
      changes are made to the file.
      Signed-off-by: default avatarFilipe Brandenburger <filbranden@google.com>
      Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      9185aa58