bcache: Don't return -EINTR when insert finished
authorKent Overstreet <kmo@daterainc.com>
Sat, 7 Dec 2013 11:57:58 +0000 (03:57 -0800)
committerKent Overstreet <kmo@daterainc.com>
Wed, 8 Jan 2014 21:05:14 +0000 (13:05 -0800)
We need to return -EINTR after a split because we invalidated iterators
(and freed the btree node) - but if we were finished inserting, we don't
want to redo the traversal.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
drivers/md/bcache/btree.c

index 463d2800a955e65844e9f76d974aefb3f037b671..98cc0a810a366a466253d250baba5c2564e9fab7 100644 (file)
@@ -2002,8 +2002,10 @@ static int bch_btree_insert_node(struct btree *b, struct btree_op *op,
                        return -EINTR;
                } else {
                        /* Invalidated all iterators */
-                       return btree_split(b, op, insert_keys, replace_key) ?:
-                               -EINTR;
+                       int ret = btree_split(b, op, insert_keys, replace_key);
+
+                       return bch_keylist_empty(insert_keys) ?
+                               0 : ret ?: -EINTR;
                }
        } else {
                BUG_ON(write_block(b) != btree_bset_last(b));