1. 26 10月, 2012 7 次提交
    • M
      Btrfs: fix deadlock caused by the nested chunk allocation · 671415b7
      Miao Xie 提交于
      Steps to reproduce:
       # mkfs.btrfs -m raid1 <disk1> <disk2>
       # btrfstune -S 1 <disk1>
       # mount <disk1> <mnt>
       # btrfs device add <disk3> <disk4> <mnt>
       # mount -o remount,rw <mnt>
       # dd if=/dev/zero of=<mnt>/tmpfile bs=1M count=1
       Deadlock happened.
      
      It is because of the nested chunk allocation. When we wrote the data
      into the filesystem, we would allocate the data chunk because there was
      no data chunk in the filesystem. At the end of the data chunk allocation,
      we should insert the metadata of the data chunk into the extent tree, but
      there was no raid1 chunk, so we tried to lock the chunk allocation mutex to
      allocate the new chunk, but we had held the mutex, the deadlock happened.
      
      By rights, we would allocate the raid1 chunk when we added the second device
      because the profile of the seed filesystem is raid1 and we had two devices.
      But we didn't do that in fact. It is because the last step of the first device
      insertion didn't commit the transaction. So when we added the second device,
      we didn't cow the tree, and just inserted the relative metadata into the leaves
      which were generated by the first device insertion, and its profile was dup.
      
      So, I fix this problem by commiting the transaction at the end of the first
      device insertion.
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      671415b7
    • L
      btrfs: Return EINVAL when length to trim is less than FSB · e515c18b
      Lukas Czerner 提交于
      Currently if len argument in btrfs_ioctl_fitrim() is smaller than
      one FSB we will continue and finally return 0 bytes discarded.
      However if the length to discard is smaller then file system block
      we should really return EINVAL.
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      e515c18b
    • T
      Btrfs: fix memory leak in btrfs_quota_enable() · 5b7ff5b3
      Tsutomu Itoh 提交于
      We should free quota_root before returning from the error
      handling code.
      Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
      5b7ff5b3
    • A
      Btrfs: send correct rdev and mode in btrfs-send · d79e5043
      Arne Jansen 提交于
      When sending a device file, the stream was missing the mode. Also the
      rdev was encoded wrongly.
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      d79e5043
    • J
      Btrfs: extended inode refs support for send mechanism · 96b5bd77
      Jan Schmidt 提交于
      This adds support for the new extended inode refs to btrfs send.
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      96b5bd77
    • S
      Btrfs: Fix wrong error handling code · 84167d19
      Stefan Behrens 提交于
      gcc says "warning: comparison of unsigned expression >= 0 is always
      true" because i is an unsigned long. And gcc is right this time.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      84167d19
    • G
      Fix a sign bug causing invalid memory access in the ino_paths ioctl. · 661bec6b
      Gabriel de Perthuis 提交于
      To see the problem, create many hardlinks to the same file (120 should do it),
      then look up paths by inode with:
      
        ls -i
        btrfs inspect inode-resolve -v $ino /mnt/btrfs
      
      I noticed the memory layout of the fspath->val data had some irregularities
      (some unnecessary gaps that stop appearing about halfway),
      so I'm not sure there aren't any bugs left in it.
      661bec6b
  2. 09 10月, 2012 33 次提交