1. 16 6月, 2012 1 次提交
  2. 15 6月, 2012 3 次提交
    • L
      Btrfs: do not resize a seeding device · 4e42ae1b
      Liu Bo 提交于
      Seeding devices are not supposed to change any more.
      Signed-off-by: NLiu Bo <liubo2009@cn.fujitsu.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      4e42ae1b
    • L
      Btrfs: fix defrag regression · 6c282eb4
      Li Zefan 提交于
      If a file has 3 small extents:
      
      | ext1 | ext2 | ext3 |
      
      Running "btrfs fi defrag" will only defrag the last two extents, if those
      extent mappings hasn't been read into memory from disk.
      
      This bug was introduced by commit 17ce6ef8
      ("Btrfs: add a check to decide if we should defrag the range")
      
      The cause is, that commit looked into previous and next extents using
      lookup_extent_mapping() only.
      
      While at it, remove the code that checks the previous extent, since
      it's sufficient to check the next extent.
      Signed-off-by: NLi Zefan <lizefan@huawei.com>
      6c282eb4
    • J
      Btrfs: use rcu to protect device->name · 606686ee
      Josef Bacik 提交于
      Al pointed out that we can just toss out the old name on a device and add a
      new one arbitrarily, so anybody who uses device->name in printk could
      possibly use free'd memory.  Instead of adding locking around all of this he
      suggested doing it with RCU, so I've introduced a struct rcu_string that
      does just that and have gone through and protected all accesses to
      device->name that aren't under the uuid_mutex with rcu_read_lock().  This
      protects us and I will use it for dealing with removing the device that we
      used to mount the file system in a later patch.  Thanks,
      Reviewed-by: NDavid Sterba <dsterba@suse.cz>
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      606686ee
  3. 30 5月, 2012 5 次提交
  4. 26 5月, 2012 1 次提交
  5. 19 4月, 2012 1 次提交
  6. 29 3月, 2012 5 次提交
  7. 27 3月, 2012 1 次提交
    • J
      Btrfs: fix regression in scrub path resolving · 7a3ae2f8
      Jan Schmidt 提交于
      In commit 4692cf58 we introduced new backref walking code for btrfs. This
      assumes we're searching live roots, which requires a transaction context.
      While scrubbing, however, we must not join a transaction because this could
      deadlock with the commit path. Additionally, what scrub really wants to do
      is resolving a logical address in the commit root it's currently checking.
      
      This patch adds support for logical to path resolving on commit roots and
      makes scrub use that.
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      7a3ae2f8
  8. 22 3月, 2012 3 次提交
  9. 23 2月, 2012 1 次提交
  10. 17 2月, 2012 1 次提交
    • M
      Btrfs: fix deadlock on page lock when doing auto-defragment · 600a45e1
      Miao Xie 提交于
      When I ran xfstests circularly on a auto-defragment btrfs, the deadlock
      happened.
      
      Steps to reproduce:
      [tty0]
       # export MOUNT_OPTIONS="-o autodefrag"
       # export TEST_DEV=<partition1>
       # export TEST_DIR=<mountpoint1>
       # export SCRATCH_DEV=<partition2>
       # export SCRATCH_MNT=<mountpoint2>
       # while [ 1 ]
       > do
       > ./check 091 127 263
       > sleep 1
       > done
      [tty1]
       # while [ 1 ]
       > do
       > echo 3 > /proc/sys/vm/drop_caches
       > done
      
      Several hours later, the test processes will hang on, and the deadlock will
      happen on page lock.
      
      The reason is that:
        Auto defrag task		Flush thread			Test task
      				btrfs_writepages()
      				  add ordered extent
      				  (including page 1, 2)
      				  set page 1 writeback
      				  set page 2 writeback
      				endio_fn()
      				  end page 2 writeback
      								release page 2
      lock page 1
      alloc and lock page 2
      page 2 is not uptodate
        btrfs_readpage()
          start ordered extent()
          btrfs_writepages()
            try  to lock page 1
      
      so deadlock happens.
      
      Fix this bug by unlocking the page which is in writeback, and re-locking it
      after the writeback end.
      Signed-off-by: NMiao Xie <miax@cn.fujitsu.com>
      600a45e1
  11. 27 1月, 2012 1 次提交
  12. 17 1月, 2012 7 次提交
  13. 11 1月, 2012 2 次提交
  14. 09 1月, 2012 1 次提交
  15. 05 1月, 2012 1 次提交
    • J
      Btrfs: new backref walking code · 4692cf58
      Jan Schmidt 提交于
      The old backref iteration code could only safely be used on commit roots.
      Besides this limitation, it had bugs in finding the roots for these
      references. This commit replaces large parts of it by btrfs_find_all_roots()
      which a) really finds all roots and the correct roots, b) works correctly
      under heavy file system load, c) considers delayed refs.
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      4692cf58
  16. 04 1月, 2012 2 次提交
  17. 22 12月, 2011 1 次提交
    • A
      Btrfs: mark delayed refs as for cow · 66d7e7f0
      Arne Jansen 提交于
      Add a for_cow parameter to add_delayed_*_ref and pass the appropriate value
      from every call site. The for_cow parameter will later on be used to
      determine if a ref will change anything with respect to qgroups.
      
      Delayed refs coming from relocation are always counted as for_cow, as they
      don't change subvol quota.
      
      Also pass in the fs_info for later use.
      
      btrfs_find_all_roots() will use this as an optimization, as changes that are
      for_cow will not change anything with respect to which root points to a
      certain leaf. Thus, we don't need to add the current sequence number to
      those delayed refs.
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      66d7e7f0
  18. 16 12月, 2011 1 次提交
    • J
      Btrfs: fix how we do delalloc reservations and how we free reservations on error · 660d3f6c
      Josef Bacik 提交于
      Running xfstests 269 with some tracing my scripts kept spitting out errors about
      releasing bytes that we didn't actually have reserved.  This took me down a huge
      rabbit hole and it turns out the way we deal with reserved_extents is wrong,
      we need to only be setting it if the reservation succeeds, otherwise the free()
      method will come in and unreserve space that isn't actually reserved yet, which
      can lead to other warnings and such.  The math was all working out right in the
      end, but it caused all sorts of other issues in addition to making my scripts
      yell and scream and generally make it impossible for me to track down the
      original issue I was looking for.  The other problem is with our error handling
      in the reservation code.  There are two cases that we need to deal with
      
      1) We raced with free.  In this case free won't free anything because csum_bytes
      is modified before we dro the lock in our reservation path, so free rightly
      doesn't release any space because the reservation code may be depending on that
      reservation.  However if we fail, we need the reservation side to do the free at
      that point since that space is no longer in use.  So as it stands the code was
      doing this fine and it worked out, except in case #2
      
      2) We don't race with free.  Nobody comes in and changes anything, and our
      reservation fails.  In this case we didn't reserve anything anyway and we just
      need to clean up csum_bytes but not free anything.  So we keep track of
      csum_bytes before we drop the lock and if it hasn't changed we know we can just
      decrement csum_bytes and carry on.
      
      Because of the case where we can race with free()'s since we have to drop our
      spin_lock to do the reservation, I'm going to serialize all reservations with
      the i_mutex.  We already get this for free in the heavy use paths, truncate and
      file write all hold the i_mutex, just needed to add it to page_mkwrite and
      various ioctl/balance things.  With this patch my space leak scripts no longer
      scream bloody murder.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      660d3f6c
  19. 15 12月, 2011 1 次提交
    • L
      Btrfs: fix ctime update of on-disk inode · 306424cc
      Li Zefan 提交于
      To reproduce the bug:
      
          # touch /mnt/tmp
          # stat /mnt/tmp | grep Change
          Change: 2011-12-09 09:32:23.412105981 +0800
          # chattr +i /mnt/tmp
          # stat /mnt/tmp | grep Change
          Change: 2011-12-09 09:32:43.198105295 +0800
          # umount /mnt
          # mount /dev/loop1 /mnt
          # stat /mnt/tmp | grep Change
          Change: 2011-12-09 09:32:23.412105981 +0800
      
      We should update ctime of in-memory inode before calling
      btrfs_update_inode().
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      306424cc
  20. 01 12月, 2011 1 次提交