1. 22 3月, 2012 21 次提交
    • M
      btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range() · 0678b618
      Mark Fasheh 提交于
      Unfortunately it isn't enough to just exit here - the kzalloc() happens in a
      loop and the allocated items are added to a linked list whose head is passed
      in from the caller.
      
      To fix the BUG_ON() and also provide the semantic that the list passed in is
      only modified on success, I create function-local temporary list that we add
      items too. If no error is met, that list is spliced to the callers at the
      end of the function. Otherwise the list will be walked and all items freed
      before the error value is returned.
      
      I did a simple test on this patch by forcing an error at the kzalloc() point
      and verifying that when this hits (git clone seemed to exercise this), the
      function throws the proper error. Unfortunately but predictably, we later
      hit a BUG_ON(ret) type line that still hasn't been fixed up ;)
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      0678b618
    • M
      btrfs: Don't BUG_ON() errors in update_ref_for_cow() · be1a5564
      Mark Fasheh 提交于
      The only caller of update_ref_for_cow() is __btrfs_cow_block() which was
      originally ignoring any return values. update_ref_for_cow() however doesn't
      look like a candidate to become a void function - there are a few places
      where errors can occur.
      
      So instead I changed update_ref_for_cow() to bubble all errors up (instead
      of BUG_ON). __btrfs_cow_block() was then updated to catch and BUG_ON() any
      errors from update_ref_for_cow(). The end effect is that we have no change
      in behavior, but about 8 different places where a BUG_ON(ret) was removed.
      
      Obviously a future patch will have to address the BUG_ON() in
      __btrfs_cow_block().
      Signed-off-by: NMark Fasheh <mfasheh@suse.de>
      be1a5564
    • M
      btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() · ce598979
      Mark Fasheh 提交于
      This is called from only one place - create_subvol() which passes errors
      safely back out to it's caller, btrfs_mksubvol where they are handled.
      
      Additionally, btrfs_create_subvol_root() itself bug's needlessly from error
      return of btrfs_update_inode(). Since create_subvol() was fixed to catch
      errors we can bubble this one up too.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      ce598979
    • J
      btrfs: btrfs_drop_snapshot should return int · 2c536799
      Jeff Mahoney 提交于
      Commit cb1b69f4 (Btrfs: forced readonly when btrfs_drop_snapshot() fails)
      made btrfs_drop_snapshot return void because there were no callers checking
      the return value. That is the wrong order to handle error propogation since
      the caller will have no idea that an error has occured and continue on
      as if nothing went wrong.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      2c536799
    • J
      btrfs: split extent_state ops · 3fbe5c02
      Jeff Mahoney 提交于
       set_extent_bit can do exclusive locking but only when called by lock_extent*,
      
       Drop the exclusive bits argument except when called by lock_extent.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      3fbe5c02
    • J
      btrfs: drop gfp_t from lock_extent · d0082371
      Jeff Mahoney 提交于
       lock_extent and unlock_extent are always called with GFP_NOFS, drop the
       argument and use GFP_NOFS consistently.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      d0082371
    • J
      143bede5
    • J
      btrfs: __add_reloc_root error push-up · ffd7b339
      Jeff Mahoney 提交于
      This patch pushes kmalloc errors up to the caller and BUGs in the caller.
      
      The BUG_ON for duplicate reloc tree root insertion is replaced with a
      panic explaining the issue.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      ffd7b339
    • J
      btrfs: ->submit_bio_hook error push-up · 355808c2
      Jeff Mahoney 提交于
      This pushes failures from the submit_bio_hook callbacks,
      btrfs_submit_bio_hook and btree_submit_bio_hook into the callers, including
      callers of submit_one_bio where it catches the failures with BUG_ON.
      
      It also pushes up through the ->readpage_io_failed_hook to
      end_bio_extent_writepage where the error is already caught with BUG_ON.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      355808c2
    • J
      btrfs: Factor out tree->ops->merge_bio_hook call · 3444a972
      Jeff Mahoney 提交于
      In submit_extent_page, there's a visually noisy if statement that, in
      the midst of other conditions, does the tree dependency for tree->ops
      and tree->ops->merge_bio_hook before calling it, and then another
      condition afterwards. If an error is returned from merge_bio_hook,
      there's no way to catch it. It's considered a routine "1" return
      value instead of a failure.
      
      This patch factors out the dependency check into a new local merge_bio
      routine and BUG's on an error. The if statement is less noisy as a side-
      effect.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      3444a972
    • J
      btrfs: Simplify btrfs_submit_bio_hook · 0417341e
      Jeff Mahoney 提交于
      btrfs_submit_bio_hook currently calls btrfs_bio_wq_end_io in either case
      of an if statement that determines one of the arguments.
      
      This patch moves the function call outside of the if statement and uses it
      to only determine the different argument. This allows us to catch an
      error in one place in a more visually obvious way.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      0417341e
    • J
      btrfs: btrfs_update_root error push-up · b45a9d8b
      Jeff Mahoney 提交于
      btrfs_update_root BUG's when it can't alloc a path, yet it can recover
      from a search error. This patch returns -ENOMEM instead.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      b45a9d8b
    • J
      btrfs: find_and_setup_root error push-up · 200a5c17
      Jeff Mahoney 提交于
      find_and_setup_root BUGs when it encounters an error from
      btrfs_find_last_root, which can occur if a path can't be allocated.
      
      This patch pushes it up to its callers where it is already handled.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      200a5c17
    • J
      btrfs: Remove set bits return from clear_extent_bit · 6763af84
      Jeff Mahoney 提交于
      There is only one caller of clear_extent_bit that checks the return value
      and it only checks if it's negative. Since there are no users of the
      returned bits functionality of clear_extent_bit, stop returning it
      and avoid complicating error handling.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      6763af84
    • J
      btrfs: avoid NULL deref in btrfs_reserve_extent with DEBUG_ENOSPC · 53804280
      Jeff Mahoney 提交于
       __find_space_info can return NULL but we don't check it before calling
       dump_space_info().
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      53804280
    • J
      btrfs: clean_tree_block should panic on observed memory corruption and return void · d5c13f92
      Jeff Mahoney 提交于
       The only error condition in clean_tree_block is an accounting bug.
       Returning without modifying dirty_metadata_bytes and as if the cleaning
       as been performed may cause problems later so it should panic instead.
      
       It should probably be a BUG_ON but we have btrfs_panic now.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      d5c13f92
    • J
      btrfs: Simplify btrfs_insert_root · d16cb050
      Jeff Mahoney 提交于
      btrfs_insert_root is just a wrapper for btrfs_insert_item. Just return
      the error directly.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      d16cb050
    • J
      btrfs: Fix kfree of member instead of structure · cddcd800
      Jeff Mahoney 提交于
      Correctness fix: The kfree calls in the add_delayed_* functions free
      the node that's passed into it, but the node is a member of another
      structure. It works because it's always the first member of the
      containing structure, but it should really be using the containing
      structure itself.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      cddcd800
    • J
      btrfs: Panic on bad rbtree operations · 43c04fb1
      Jeff Mahoney 提交于
      The ordered data and relocation trees have BUG_ONs to protect against
      bad tree operations.
      
      This patch replaces them with a panic that will report the problem.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      43c04fb1
    • J
      btrfs: Catch locking failures in {set,clear,convert}_extent_bit · c2d904e0
      Jeff Mahoney 提交于
      The *_state functions can only return 0 or -EEXIST. This patch addresses
      the cases where those functions returning -EEXIST represent a locking
      failure. It handles them by panicking with an appropriate error message.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      c2d904e0
    • J
      btrfs: Add btrfs_panic() · 8c342930
      Jeff Mahoney 提交于
      As part of the effort to eliminate BUG_ON as an error handling
      technique, we need to determine which errors are actual logic errors,
      which are on-disk corruption, and which are normal runtime errors
      e.g. -ENOMEM.
      
      Annotating these error cases is helpful to understand and report them.
      
      This patch adds a btrfs_panic() routine that will either panic
      or BUG depending on the new -ofatal_errors={panic,bug} mount option.
      Since there are still so many BUG_ONs, it defaults to BUG for now but I
      expect that to change once the error handling effort has made
      significant progress.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      8c342930
  2. 19 3月, 2012 2 次提交
  3. 18 3月, 2012 2 次提交
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · c579bc7e
      Linus Torvalds 提交于
      Pull networking changes from David Miller:
       "1) icmp6_dst_alloc() returns NULL instead of ERR_PTR() leading to
           crashes, particularly during shutdown.  Reported by Dave Jones and
           fixed by Eric Dumazet.
      
        2) hyperv and wimax/i2400m return NETDEV_TX_BUSY when they have
           already freed the SKB, which causes crashes as to the caller this
           means requeue the packet.  Fixes from Eric Dumazet.
      
        3) usbnet driver doesn't allocate the right amount of headroom on
           fresh RX SKBs, fix from Eric Dumazet.
      
        4) Fix regression in ip6_mc_find_dev_rcu(), as an RCU lookup it
           abolutely should not take a reference to 'dev', this leads to
           leaks.  Fix from RonQing Li.
      
        5) Fix netfilter ctnetlink race between delete and timeout expiration.
           From Pablo Neira Ayuso.
      
        6) Revert SFQ change which causes regressions, specifically queueing
           to tail can lead to unavoidable flow starvation.  From Eric
           Dumazet.
      
        7) Fix a memory leak and a crash on corrupt firmware files in bnx2x,
           from Michal Schmidt."
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        netfilter: ctnetlink: fix race between delete and timeout expiration
        ipv6: Don't dev_hold(dev) in ip6_mc_find_dev_rcu.
        wimax/i2400m: fix erroneous NETDEV_TX_BUSY use
        net/hyperv: fix erroneous NETDEV_TX_BUSY use
        net/usbnet: reserve headroom on rx skbs
        bnx2x: fix memory leak in bnx2x_init_firmware()
        bnx2x: fix a crash on corrupt firmware file
        sch_sfq: revert dont put new flow at the end of flows
        ipv6: fix icmp6_dst_alloc()
      c579bc7e
    • L
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 96ee0499
      Linus Torvalds 提交于
      Pull perf fixes from Ingo Molnar.
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf tools, x86: Build perf on older user-space as well
        perf tools: Use scnprintf where applicable
        perf tools: Incorrect use of snprintf results in SEGV
      96ee0499
  4. 17 3月, 2012 9 次提交
  5. 16 3月, 2012 6 次提交