1. 09 1月, 2012 5 次提交
  2. 22 11月, 2011 2 次提交
    • D
      ext3: NULL dereference in ext3_evict_inode() · bcdd0c16
      Dan Carpenter 提交于
      This is an fsfuzzer bug.  ->s_journal is set at the end of
      ext3_load_journal() but we try to use it in the error handling from
      ext3_get_journal() while it's still NULL.
      
      [  337.039041] BUG: unable to handle kernel NULL pointer dereference at 0000000000000024
      [  337.040380] IP: [<ffffffff816e6539>] _raw_spin_lock+0x9/0x30
      [  337.041687] PGD 0
      [  337.043118] Oops: 0002 [#1] SMP
      [  337.044483] CPU 3
      [  337.044495] Modules linked in: ecb md4 cifs fuse kvm_intel kvm brcmsmac brcmutil crc8 cordic r8169 [last unloaded: scsi_wait_scan]
      [  337.047633]
      [  337.049259] Pid: 8308, comm: mount Not tainted 3.2.0-rc2-next-20111121+ #24 SAMSUNG ELECTRONICS CO., LTD. RV411/RV511/E3511/S3511    /RV411/RV511/E3511/S3511
      [  337.051064] RIP: 0010:[<ffffffff816e6539>]  [<ffffffff816e6539>] _raw_spin_lock+0x9/0x30
      [  337.052879] RSP: 0018:ffff8800b1d11ae8  EFLAGS: 00010282
      [  337.054668] RAX: 0000000000000100 RBX: 0000000000000000 RCX: ffff8800b77c2000
      [  337.056400] RDX: ffff8800a97b5c00 RSI: 0000000000000000 RDI: 0000000000000024
      [  337.058099] RBP: ffff8800b1d11ae8 R08: 6000000000000000 R09: e018000000000000
      [  337.059841] R10: ff67366cc2607c03 R11: 00000000110688e6 R12: 0000000000000000
      [  337.061607] R13: 0000000000000000 R14: 0000000000000000 R15: ffff8800a78f06e8
      [  337.063385] FS:  00007f9d95652800(0000) GS:ffff8800b7180000(0000) knlGS:0000000000000000
      [  337.065110] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  337.066801] CR2: 0000000000000024 CR3: 00000000aef2c000 CR4: 00000000000006e0
      [  337.068581] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  337.070321] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  337.072105] Process mount (pid: 8308, threadinfo ffff8800b1d10000, task ffff8800b1d02be0)
      [  337.073800] Stack:
      [  337.075487]  ffff8800b1d11b08 ffffffff811f48cf ffff88007ac9b158 0000000000000000
      [  337.077255]  ffff8800b1d11b38 ffffffff8119405d ffff88007ac9b158 ffff88007ac9b250
      [  337.078851]  ffffffff8181bda0 ffffffff8181bda0 ffff8800b1d11b68 ffffffff81131e31
      [  337.080284] Call Trace:
      [  337.081706]  [<ffffffff811f48cf>] log_start_commit+0x1f/0x40
      [  337.083107]  [<ffffffff8119405d>] ext3_evict_inode+0x1fd/0x2a0
      [  337.084490]  [<ffffffff81131e31>] evict+0xa1/0x1a0
      [  337.085857]  [<ffffffff81132031>] iput+0x101/0x210
      [  337.087220]  [<ffffffff811339d1>] iget_failed+0x21/0x30
      [  337.088581]  [<ffffffff811905fc>] ext3_iget+0x15c/0x450
      [  337.089936]  [<ffffffff8118b0c1>] ? ext3_rsv_window_add+0x81/0x100
      [  337.091284]  [<ffffffff816df9a4>] ext3_get_journal+0x15/0xde
      [  337.092641]  [<ffffffff811a2e9b>] ext3_fill_super+0xf2b/0x1c30
      [  337.093991]  [<ffffffff810ddf7d>] ? register_shrinker+0x4d/0x60
      [  337.095332]  [<ffffffff8111c112>] mount_bdev+0x1a2/0x1e0
      [  337.096680]  [<ffffffff811a1f70>] ? ext3_setup_super+0x210/0x210
      [  337.098026]  [<ffffffff8119a770>] ext3_mount+0x10/0x20
      [  337.099362]  [<ffffffff8111cbee>] mount_fs+0x3e/0x1b0
      [  337.100759]  [<ffffffff810eda1b>] ? __alloc_percpu+0xb/0x10
      [  337.102330]  [<ffffffff81135385>] vfs_kern_mount+0x65/0xc0
      [  337.103889]  [<ffffffff8113611f>] do_kern_mount+0x4f/0x100
      [  337.105442]  [<ffffffff811378fc>] do_mount+0x19c/0x890
      [  337.106989]  [<ffffffff810e8456>] ? memdup_user+0x46/0x90
      [  337.108572]  [<ffffffff810e84f3>] ? strndup_user+0x53/0x70
      [  337.110114]  [<ffffffff811383fb>] sys_mount+0x8b/0xe0
      [  337.111617]  [<ffffffff816ed93b>] system_call_fastpath+0x16/0x1b
      [  337.113133] Code: 38 c2 74 0f 66 0f 1f 44 00 00 f3 90 0f b6 03 38 c2 75 f7 48 83 c4 08 5b 5d c3 0f 1f 84 00 00 00 00 00 55 b8 00 01 00 00 48 89 e5 <f0> 66 0f c1 07 0f b6 d4 38 c2 74 0c 0f 1f 00 f3 90 0f b6 07 38
      [  337.116588] RIP  [<ffffffff816e6539>] _raw_spin_lock+0x9/0x30
      [  337.118260]  RSP <ffff8800b1d11ae8>
      [  337.119998] CR2: 0000000000000024
      [  337.188701] ---[ end trace c36d790becac1615 ]---
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      bcdd0c16
    • Y
      jbd: clear revoked flag on buffers before a new transaction started · 8c111b3f
      Yongqiang Yang 提交于
      Currently, we clear revoked flag only when a block is reused.  However,
      this can tigger a false journal error.  Consider a situation when a block
      is used as a meta block and is deleted(revoked) in ordered mode, then the
      block is allocated as a data block to a file.  At this moment, user changes
      the file's journal mode from ordered to journaled and truncates the file.
      The block will be considered re-revoked by journal because it has revoked
      flag still pending from the last transaction and an assertion triggers.
      
      We fix the problem by keeping the revoked status more uptodate - we clear
      revoked flag when switching revoke tables to reflect there is no revoked
      buffers in current transaction any more.
      Signed-off-by: NYongqiang Yang <xiaoqiangnk@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      8c111b3f
  3. 09 11月, 2011 1 次提交
  4. 08 11月, 2011 2 次提交
  5. 07 11月, 2011 1 次提交
  6. 06 11月, 2011 22 次提交
    • C
      Btrfs: fix race during transaction joins · d43317dc
      Chris Mason 提交于
      While we're allocating ram for a new transaction, we drop our spinlock.
      When we get the lock back, we do check to see if a transaction started
      while we slept, but we don't check to make sure it isn't blocked
      because a commit has already started.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d43317dc
    • I
      Btrfs: fix a potential btrfs_bio leak on scrub fixups · 56d2a48f
      Ilya Dryomov 提交于
      In case we were able to map less than we wanted (length < PAGE_SIZE
      clause is true) btrfs_bio is still allocated and we have to free it.
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      56d2a48f
    • I
      21ca543e
    • I
      Btrfs: stop leaking btrfs_bios on readahead · 9510dc4c
      Ilya Dryomov 提交于
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      9510dc4c
    • C
      Btrfs: stop the readahead threads on failed mount · 306c8b68
      Chris Mason 提交于
      If we don't stop them, they linger around corrupting
      memory by using pointers to freed things.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      306c8b68
    • C
      Btrfs: fix extent_buffer leak in the metadata IO error handling · c674e04e
      Chris Mason 提交于
      The scrub readahead branch brought in a new error handling hook,
      but it was leaking extent_buffer references.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c674e04e
    • C
      Btrfs: fix the new inspection ioctls for 32 bit compat · 740c3d22
      Chris Mason 提交于
      The new ioctls to follow backrefs are not clean for 32/64 bit
      compat.  This reworks them for u64s everywhere.  They are brand new, so
      there are no problems with changing the interface now.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      740c3d22
    • J
      Btrfs: fix delayed insertion reservation · c06a0e12
      Josef Bacik 提交于
      We all keep getting those stupid warnings from use_block_rsv when running
      stress.sh, and it's because the delayed insertion stuff is being stupid.  It's
      not the delayed insertion stuffs fault, it's all just stupid.  When marking an
      inode dirty for oh say updating the time on it, we just do a
      btrfs_join_transaction, which doesn't reserve any space.  This is stupid because
      we're going to have to have space reserve to make this change, but we do it
      because it's fast because chances are we're going to call it over and over again
      and it doesn't matter.  Well thanks to the delayed insertion stuff this is
      mostly the case, so we do actually need to make this reservation.  So if
      trans->bytes_reserved is 0 then try to do a normal reservation.  If not return
      ENOSPC which will make the btrfs_dirty_inode start a proper transaction which
      will let it do the whole ENOSPC dance and reserve enough space for the delayed
      insertion to steal the reservation from the transaction.
      
      The other stupid thing we do is not reserve space for the inode when writing to
      the thing.  Usually this is ok since we have to update the time so we'd have
      already done all this work before we get to the endio stuff, so it doesn't
      matter.  But this is stupid because we could write the data after the
      transaction commits where we changed the mtime of the inode so we have to cow
      all the way down to the inode anyway.  This used to be masked by the delalloc
      reservation stuff, but because we delay the update it doesn't get masked in this
      case.  So again the delayed insertion stuff bites us in the ass.  So if our
      trans->block_rsv is delalloc, just steal the reservation from the delalloc
      reserve.  Hopefully this won't bite us in the ass, but I've said that before.
      
      With this patch stress.sh no longer spits out those stupid warnings (famous last
      words).  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c06a0e12
    • C
      Btrfs: ClearPageError during writepage and clean_tree_block · bf0da8c1
      Chris Mason 提交于
      Failure testing was tripping up over stale PageError bits in
      metadata pages.  If we have an io error on a block, and later on
      end up reusing it, nobody ever clears PageError on those pages.
      
      During commit, we'll find PageError and think we had trouble writing
      the block, which will lead to aborts and other problems.
      
      This changes clean_tree_block and the btrfs writepage code to
      clear the PageError bit.  In both cases we're either completely
      done with the page or the page has good stuff and the error bit
      is no longer valid.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      bf0da8c1
    • J
      Btrfs: be smarter about committing the transaction in reserve_metadata_bytes · 663350ac
      Josef Bacik 提交于
      Because of the overcommit stuff I had to make it so that we committed the
      transaction all the time in reserve_metadata_bytes in case we had overcommitted
      because of delayed items.  This was because previously we had no way of knowing
      how much space was reserved for delayed items.  Now that we have the
      delayed_block_rsv we can check it to see if committing the transaction would get
      us anywhere.  This patch breaks out the committing logic into a helper function
      that will check to see if committing the transaction would free enough space for
      us to get anything done.  With this patch xfstests 83 goes from taking 445
      seconds to taking 28 seconds on my box.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      663350ac
    • J
      Btrfs: make a delayed_block_rsv for the delayed item insertion · 6d668dda
      Josef Bacik 提交于
      I've been hitting warnings in use_block_rsv when running the delayed insertion
      stuff.  It's because we will readjust global block rsv based on what is in use,
      which means we could end up discarding reservations that are for the delayed
      insertion stuff.  So instead create a seperate block rsv for the delayed
      insertion stuff.  This will also make it easier to debug problems with the
      delayed insertion reservations since we will know that only the delayed
      insertion code touches this block_rsv.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      6d668dda
    • C
      Btrfs: add a log of past tree roots · af31f5e5
      Chris Mason 提交于
      This takes some of the free space in the btrfs super block
      to record information about most of the roots in the last four
      commits.
      
      It also adds a -o recovery to use the root history log when
      we're not able to read the tree of tree roots, the extent
      tree root, the device tree root or the csum root.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      af31f5e5
    • D
      btrfs: separate superblock items out of fs_info · 6c41761f
      David Sterba 提交于
      fs_info has now ~9kb, more than fits into one page. This will cause
      mount failure when memory is too fragmented. Top space consumers are
      super block structures super_copy and super_for_commit, ~2.8kb each.
      Allocate them dynamically. fs_info will be ~3.5kb. (measured on x86_64)
      
      Add a wrapper for freeing fs_info and all of it's dynamically allocated
      members.
      Signed-off-by: NDavid Sterba <dsterba@suse.cz>
      6c41761f
    • J
      Btrfs: use the global reserve when truncating the free space cache inode · c8174313
      Josef Bacik 提交于
      We no longer use the orphan block rsv for holding the reservation for truncating
      the inode, so instead use the global block rsv and check to make sure it has
      enough space for us to truncate the space.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c8174313
    • J
      Btrfs: release metadata from global reserve if we have to fallback for unlink · 5a77d76c
      Josef Bacik 提交于
      I fixed a problem where we weren't reserving space for an orphan item when we
      had to fallback to using the global reserve for an unlink, but I introduced
      another problem.  I was migrating the bytes from the transaction reserve to the
      global reserve and then releasing from the global reserve in
      btrfs_end_transaction().  The problem with this is that a migrate will jack up
      the size for the destination, but leave the size alone for the source, with the
      idea that you can do a release normally on the source and it all washes out, and
      then you can do a release again on the destination and it works out right.  My
      way was skipping the release on the trans_block_rsv which still had the jacked
      up size from our original reservation.  So instead release manually from the
      global reserve if this transaction was using it, and then set the
      trans->block_rsv back to the trans_block_rsv so that btrfs_end_transaction
      cleans everything up properly.  With this patch xfstest 83 doesn't emit warnings
      about leaking space.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      5a77d76c
    • C
      Btrfs: make sure to flush queued bios if write_cache_pages waits · 01d658f2
      Chris Mason 提交于
      write_cache_pages tries to build up a large bio to stuff down the pipe.
      But if it needs to wait for a page lock, it needs to make sure and send
      down any pending writes so we don't deadlock with anyone who has the
      page lock and is waiting for writeback of things inside the bio.
      
      Dave Sterba triggered this as a deadlock between the autodefrag code and
      the extent write_cache_pages
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      01d658f2
    • C
      Btrfs: fix extent pinning bugs in the tree log · e688b725
      Chris Mason 提交于
      The tree log had two important bugs that could cause corruptions after a
      crash.  Sometimes we were allowing tree log blocks to be reused after
      the tree log was committed but before the transaction commit was done.
      
      This allowed a future metadata write to overwrite the tree log data.  It
      is fixed by adding a new variant of freeing reserved extents that always
      pins them.  Credit goes to Stefan Behrens and Arne Jansen for many many
      hours spent tracking this bug down.
      
      During tree log replay, we do a pass through the tree log and pin all
      the extents we find.  This makes sure the replay code won't go in and
      use any of those blocks for new allocations during replay.  The problem
      is the free space cache isn't honoring these pinned extents.  So the
      allocator can end up handing them out, leading to all kinds of problems
      during replay.
      
      The fix here is to force any free space cache to load while we pin the
      extents, and then to make sure we remove the pinned extents from the
      free space rbtree.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      Reported-by: NStefan Behrens <sbehrens@giantdisaster.de>
      e688b725
    • C
      Btrfs: make sure btrfs_remove_free_space doesn't leak EAGAIN · 1eae31e9
      Chris Mason 提交于
      btrfs_remove_free_space needs to make sure to set ret back to a
      valid return value after setting it to EAGAIN, otherwise we return
      it to the callers.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      1eae31e9
    • C
      Btrfs: don't wait as long for more batches during SSD log commit · cd354ad6
      Chris Mason 提交于
      When we're doing log commits, we try to wait for more writers to come in
      and make the commit bigger.  This helps improve performance on rotating
      disks, but on SSDs it adds latencies.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      cd354ad6
    • H
      ceph/super.c: quiet sparse noise · 0c6d4b4e
      H Hartley Sweeten 提交于
      Quiet the sparse noise:
      
      warning: symbol 'create_fs_client' was not declared. Should it be static?
      warning: symbol 'destroy_fs_client' was not declared. Should it be static?
      Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
      Cc: Sage Weil <sage@newdream.net>
      ceph-devel@vger.kernel.org
      Signed-off-by: NSage Weil <sage@newdream.net>
      0c6d4b4e
    • H
      ceph/mds_client.c: quiet sparse noise · 7fd7d101
      H Hartley Sweeten 提交于
      Quiet the following sparse noise:
      
      warning: symbol 'get_nonsnap_parent' was not declared. Should it be static?
      warning: symbol 'done_closing_sessions' was not declared. Should it be static?
      
      Local functions don't need external visability. Make them static.
      Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
      Cc: Sage Weil <sage@newdream.net>
      Signed-off-by: NSage Weil <sage@newdream.net>
      7fd7d101
    • S
      ceph: use new D_COMPLETE dentry flag · c6ffe100
      Sage Weil 提交于
      We used to use a flag on the directory inode to track whether the dcache
      contents for a directory were a complete cached copy.  Switch to a dentry
      flag CEPH_D_COMPLETE that is safely updated by ->d_prune().
      Signed-off-by: NSage Weil <sage@newdream.net>
      c6ffe100
  7. 05 11月, 2011 1 次提交
    • D
      VFS: fix statfs() automounter semantics regression · 5c8a0fbb
      Dan McGee 提交于
      No one in their right mind would expect statfs() to not work on a
      automounter managed mount point. Fix it.
      
      [ I'm not sure about the "no one in their right mind" part.  It's not
        mounted, and you didn't ask for it to be mounted.  But nobody will
        really care, and this probably makes it match previous semantics, so..
            - Linus ]
      
      This mirrors the fix made to the quota code in 815d405c.
      Signed-off-by: NDan McGee <dpmcgee@gmail.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5c8a0fbb
  8. 04 11月, 2011 4 次提交
  9. 03 11月, 2011 2 次提交