1. 11 Sep, 2011 9 commits
    • David Sterba's avatar
      btrfs: xattr: fix attribute removal · 4815053a
      David Sterba authored
      An attribute is not removed by 'setfattr -x attr file' and remains
      visible in attr list. This makes xfstests/062 pass again.
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      4815053a
    • Miao Xie's avatar
      Btrfs: fix wrong nbytes information of the inode · a39f7521
      Miao Xie authored
      If we write some data into the data hole of the file(no preallocation for this
      hole), Btrfs will allocate some disk space, and update nbytes of the inode, but
      the other element--disk_i_size needn't be updated. At this condition, we must
      update inode metadata though disk_i_size is not changed(btrfs_ordered_update_i_size()
      return 1).
      
       # mkfs.btrfs /dev/sdb1
       # mount /dev/sdb1 /mnt
       # touch /mnt/a
       # truncate -s 856002 /mnt/a
       # dd if=/dev/zero of=/mnt/a bs=4K count=1 conv=nocreat,notrunc
       # umount /mnt
       # btrfsck /dev/sdb1
       root 5 inode 257 errors 400
       found 32768 bytes used err is 1
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      a39f7521
    • Miao Xie's avatar
      Btrfs: fix the file extent gap when doing direct IO · 0c1a98c8
      Miao Xie authored
      When we write some data to the place that is beyond the end of the file
      in direct I/O mode, a data hole will be created. And Btrfs should insert
      a file extent item that point to this hole into the fs tree. But unfortunately
      Btrfs forgets doing it.
      
      The following is a simple way to reproduce it:
       # mkfs.btrfs /dev/sdc2
       # mount /dev/sdc2 /test4
       # touch /test4/a
       # dd if=/dev/zero of=/test4/a seek=8 count=1 bs=4K oflag=direct conv=nocreat,notrunc
       # umount /test4
       # btrfsck /dev/sdc2
       root 5 inode 257 errors 100
      Reported-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      Tested-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      0c1a98c8
    • Miao Xie's avatar
      Btrfs: fix unclosed transaction handle in btrfs_cont_expand · 5b397377
      Miao Xie authored
      The function - btrfs_cont_expand() forgot to close the transaction handle before
      it jump out the while loop. Fix it.
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      5b397377
    • Liu Bo's avatar
      Btrfs: fix misuse of trans block rsv · 98c9942a
      Liu Bo authored
      At the beginning of create_pending_snapshot, trans->block_rsv is set
      to pending->block_rsv and is used for snapshot things, however, when
      it is done, we do not recover it as will.
      Signed-off-by: default avatarLiu Bo <liubo2009@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      98c9942a
    • Liu Bo's avatar
      Btrfs: reset to appropriate block rsv after orphan operations · 65450aa6
      Liu Bo authored
      While truncating free space cache, we forget to change trans->block_rsv
      back to the original one, but leave it with the orphan_block_rsv, and
      then with option inode_cache enable, it leads to countless warnings of
      btrfs_alloc_free_block and btrfs_orphan_commit_root:
      
      WARNING: at fs/btrfs/extent-tree.c:5711 btrfs_alloc_free_block+0x180/0x350 [btrfs]()
      ...
      WARNING: at fs/btrfs/inode.c:2193 btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]()
      Signed-off-by: default avatarLiu Bo <liubo2009@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      65450aa6
    • Josef Bacik's avatar
      Btrfs: skip locking if searching the commit root in csum lookup · ddf23b3f
      Josef Bacik authored
      It's not enough to just search the commit root, since we could be cow'ing the
      very block we need to search through, which would mean that its locked and we'll
      still deadlock.  So use path->skip_locking as well.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      ddf23b3f
    • Sergei Trofimovich's avatar
      btrfs: fix warning in iput for bad-inode · e0b6d65b
      Sergei Trofimovich authored
      iput() shouldn't be called for inodes in I_NEW state.
      We need to mark inode as constructed first.
      
      WARNING: at fs/inode.c:1309 iput+0x20b/0x210()
      Call Trace:
       [<ffffffff8103e7ba>] warn_slowpath_common+0x7a/0xb0
       [<ffffffff8103e805>] warn_slowpath_null+0x15/0x20
       [<ffffffff810eaf0b>] iput+0x20b/0x210
       [<ffffffff811b96fb>] btrfs_iget+0x1eb/0x4a0
       [<ffffffff811c3ad6>] btrfs_run_defrag_inodes+0x136/0x210
       [<ffffffff811ad55f>] cleaner_kthread+0x17f/0x1a0
       [<ffffffff81035b7d>] ? sub_preempt_count+0x9d/0xd0
       [<ffffffff811ad3e0>] ? transaction_kthread+0x280/0x280
       [<ffffffff8105af86>] kthread+0x96/0xa0
       [<ffffffff814336d4>] kernel_thread_helper+0x4/0x10
       [<ffffffff8105aef0>] ? kthread_worker_fn+0x190/0x190
       [<ffffffff814336d0>] ? gs_change+0xb/0xb
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      CC: Konstantin Khlebnikov <khlebnikov@openvz.org>
      Tested-by: default avatarDavid Sterba <dsterba@suse.cz>
      CC: Josef Bacik <josef@redhat.com>
      CC: Chris Mason <chris.mason@oracle.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      e0b6d65b
    • Liu Bo's avatar
      Btrfs: fix an oops when deleting snapshots · 14c7cca7
      Liu Bo authored
      We can reproduce this oops via the following steps:
      
      $ mkfs.btrfs /dev/sdb7
      $ mount /dev/sdb7 /mnt/btrfs
      $ for ((i=0; i<3; i++)); do btrfs sub snap /mnt/btrfs /mnt/btrfs/s_$i; done
      $ rm -fr /mnt/btrfs/*
      $ rm -fr /mnt/btrfs/*
      
      then we'll get
      ------------[ cut here ]------------
      kernel BUG at fs/btrfs/inode.c:2264!
      [...]
      Call Trace:
       [<ffffffffa05578c7>] btrfs_rmdir+0xf7/0x1b0 [btrfs]
       [<ffffffff81150b95>] vfs_rmdir+0xa5/0xf0
       [<ffffffff81153cc3>] do_rmdir+0x123/0x140
       [<ffffffff81145ac7>] ? fput+0x197/0x260
       [<ffffffff810aecff>] ? audit_syscall_entry+0x1bf/0x1f0
       [<ffffffff81153d0d>] sys_unlinkat+0x2d/0x40
       [<ffffffff8147896b>] system_call_fastpath+0x16/0x1b
      RIP  [<ffffffffa054f7b9>] btrfs_orphan_add+0x179/0x1a0 [btrfs]
      
      When it comes to btrfs_lookup_dentry, we may set a snapshot's inode->i_ino
      to BTRFS_EMPTY_SUBVOL_DIR_OBJECTID instead of BTRFS_FIRST_FREE_OBJECTID,
      while the snapshot's location.objectid remains unchanged.
      
      However, btrfs_ino() does not take this into account, and returns a wrong ino,
      and causes the oops.
      Signed-off-by: default avatarLiu Bo <liubo2009@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      14c7cca7
  2. 18 Aug, 2011 1 commit
  3. 17 Aug, 2011 10 commits
  4. 05 Aug, 2011 1 commit
  5. 01 Aug, 2011 19 commits