1. 22 Mar, 2012 21 commits
    • Mark Fasheh's avatar
      btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range() · 0678b618
      Mark Fasheh authored
      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: default avatarMark Fasheh <mfasheh@suse.com>
      0678b618
    • Mark Fasheh's avatar
      btrfs: Don't BUG_ON() errors in update_ref_for_cow() · be1a5564
      Mark Fasheh authored
      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: default avatarMark Fasheh <mfasheh@suse.de>
      be1a5564
    • Mark Fasheh's avatar
      btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() · ce598979
      Mark Fasheh authored
      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: default avatarMark Fasheh <mfasheh@suse.com>
      ce598979
    • Jeff Mahoney's avatar
      btrfs: btrfs_drop_snapshot should return int · 2c536799
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      2c536799
    • Jeff Mahoney's avatar
      btrfs: split extent_state ops · 3fbe5c02
      Jeff Mahoney authored
       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: default avatarJeff Mahoney <jeffm@suse.com>
      3fbe5c02
    • Jeff Mahoney's avatar
      btrfs: drop gfp_t from lock_extent · d0082371
      Jeff Mahoney authored
       lock_extent and unlock_extent are always called with GFP_NOFS, drop the
       argument and use GFP_NOFS consistently.
      Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
      d0082371
    • Jeff Mahoney's avatar
      143bede5
    • Jeff Mahoney's avatar
      btrfs: __add_reloc_root error push-up · ffd7b339
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      ffd7b339
    • Jeff Mahoney's avatar
      btrfs: ->submit_bio_hook error push-up · 355808c2
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      355808c2
    • Jeff Mahoney's avatar
      btrfs: Factor out tree->ops->merge_bio_hook call · 3444a972
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      3444a972
    • Jeff Mahoney's avatar
      btrfs: Simplify btrfs_submit_bio_hook · 0417341e
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      0417341e
    • Jeff Mahoney's avatar
      btrfs: btrfs_update_root error push-up · b45a9d8b
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      b45a9d8b
    • Jeff Mahoney's avatar
      btrfs: find_and_setup_root error push-up · 200a5c17
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      200a5c17
    • Jeff Mahoney's avatar
      btrfs: Remove set bits return from clear_extent_bit · 6763af84
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      6763af84
    • Jeff Mahoney's avatar
      btrfs: avoid NULL deref in btrfs_reserve_extent with DEBUG_ENOSPC · 53804280
      Jeff Mahoney authored
       __find_space_info can return NULL but we don't check it before calling
       dump_space_info().
      Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
      53804280
    • Jeff Mahoney's avatar
      btrfs: clean_tree_block should panic on observed memory corruption and return void · d5c13f92
      Jeff Mahoney authored
       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: default avatarJeff Mahoney <jeffm@suse.com>
      d5c13f92
    • Jeff Mahoney's avatar
      btrfs: Simplify btrfs_insert_root · d16cb050
      Jeff Mahoney authored
      btrfs_insert_root is just a wrapper for btrfs_insert_item. Just return
      the error directly.
      Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
      d16cb050
    • Jeff Mahoney's avatar
      btrfs: Fix kfree of member instead of structure · cddcd800
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      cddcd800
    • Jeff Mahoney's avatar
      btrfs: Panic on bad rbtree operations · 43c04fb1
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      43c04fb1
    • Jeff Mahoney's avatar
      btrfs: Catch locking failures in {set,clear,convert}_extent_bit · c2d904e0
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      c2d904e0
    • Jeff Mahoney's avatar
      btrfs: Add btrfs_panic() · 8c342930
      Jeff Mahoney authored
      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: default avatarJeff Mahoney <jeffm@suse.com>
      8c342930
  2. 18 Mar, 2012 3 commits
    • Linus Torvalds's avatar
      Linux 3.3 · c16fa4f2
      Linus Torvalds authored
      c16fa4f2
    • Jason Baron's avatar
      Don't limit non-nested epoll paths · 93dc6107
      Jason Baron authored
      Commit 28d82dc1 ("epoll: limit paths") that I did to limit the
      number of possible wakeup paths in epoll is causing a few applications
      to longer work (dovecot for one).
      
      The original patch is really about limiting the amount of epoll nesting
      (since epoll fds can be attached to other fds). Thus, we probably can
      allow an unlimited number of paths of depth 1. My current patch limits
      it at 1000. And enforce the limits on paths that have a greater depth.
      
      This is captured in: https://bugzilla.redhat.com/show_bug.cgi?id=681578Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      93dc6107
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · c579bc7e
      Linus Torvalds authored
      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
  3. 17 Mar, 2012 10 commits
  4. 16 Mar, 2012 6 commits