diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-17 14:04:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-17 14:04:14 -0400 |
commit | 08637024ab77f7defff1627cc8aedc2c6679ad8a (patch) | |
tree | f244009d7bacf21163b89085e82b18c85ec63fb9 | |
parent | e20437852de4aba31068037a728e2d60cf942f56 (diff) | |
parent | 3b2775942d6ccb14342f3aae55f22fbbfea8db14 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"Eric's rcu barrier patch fixes a long standing problem with our
unmount code hanging on to devices in workqueue helpers. Liu Bo
nailed down a difficult assertion for in-memory extent mappings."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: fix warning of free_extent_map
Btrfs: fix warning when creating snapshots
Btrfs: return as soon as possible when edquot happens
Btrfs: return EIO if we have extent tree corruption
btrfs: use rcu_barrier() to wait for bdev puts at unmount
Btrfs: remove btrfs_try_spin_lock
Btrfs: get better concurrency for snapshot-aware defrag work
-rw-r--r-- | fs/btrfs/extent-tree.c | 5 | ||||
-rw-r--r-- | fs/btrfs/file.c | 1 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/locking.h | 1 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 10 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 11 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 6 |
7 files changed, 25 insertions, 12 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3e074dab2d57..9ac2eca681eb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1467,8 +1467,11 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1467 | if (ret && !insert) { | 1467 | if (ret && !insert) { |
1468 | err = -ENOENT; | 1468 | err = -ENOENT; |
1469 | goto out; | 1469 | goto out; |
1470 | } else if (ret) { | ||
1471 | err = -EIO; | ||
1472 | WARN_ON(1); | ||
1473 | goto out; | ||
1470 | } | 1474 | } |
1471 | BUG_ON(ret); /* Corruption */ | ||
1472 | 1475 | ||
1473 | leaf = path->nodes[0]; | 1476 | leaf = path->nodes[0]; |
1474 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); | 1477 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index af1d0605a5c1..5b4ea5f55b8f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -591,6 +591,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
591 | } | 591 | } |
592 | compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); | 592 | compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); |
593 | clear_bit(EXTENT_FLAG_PINNED, &em->flags); | 593 | clear_bit(EXTENT_FLAG_PINNED, &em->flags); |
594 | clear_bit(EXTENT_FLAG_LOGGING, &flags); | ||
594 | remove_extent_mapping(em_tree, em); | 595 | remove_extent_mapping(em_tree, em); |
595 | if (no_splits) | 596 | if (no_splits) |
596 | goto next; | 597 | goto next; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d1470adca8f8..ca1b767d51f7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2312,6 +2312,7 @@ again: | |||
2312 | key.type = BTRFS_EXTENT_DATA_KEY; | 2312 | key.type = BTRFS_EXTENT_DATA_KEY; |
2313 | key.offset = start; | 2313 | key.offset = start; |
2314 | 2314 | ||
2315 | path->leave_spinning = 1; | ||
2315 | if (merge) { | 2316 | if (merge) { |
2316 | struct btrfs_file_extent_item *fi; | 2317 | struct btrfs_file_extent_item *fi; |
2317 | u64 extent_len; | 2318 | u64 extent_len; |
@@ -2368,6 +2369,7 @@ again: | |||
2368 | 2369 | ||
2369 | btrfs_mark_buffer_dirty(leaf); | 2370 | btrfs_mark_buffer_dirty(leaf); |
2370 | inode_add_bytes(inode, len); | 2371 | inode_add_bytes(inode, len); |
2372 | btrfs_release_path(path); | ||
2371 | 2373 | ||
2372 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, | 2374 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, |
2373 | new->disk_len, 0, | 2375 | new->disk_len, 0, |
@@ -2381,6 +2383,7 @@ again: | |||
2381 | ret = 1; | 2383 | ret = 1; |
2382 | out_free_path: | 2384 | out_free_path: |
2383 | btrfs_release_path(path); | 2385 | btrfs_release_path(path); |
2386 | path->leave_spinning = 0; | ||
2384 | btrfs_end_transaction(trans, root); | 2387 | btrfs_end_transaction(trans, root); |
2385 | out_unlock: | 2388 | out_unlock: |
2386 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, | 2389 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, |
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index ca52681e5f40..b81e0e9a4894 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | void btrfs_tree_lock(struct extent_buffer *eb); | 27 | void btrfs_tree_lock(struct extent_buffer *eb); |
28 | void btrfs_tree_unlock(struct extent_buffer *eb); | 28 | void btrfs_tree_unlock(struct extent_buffer *eb); |
29 | int btrfs_try_spin_lock(struct extent_buffer *eb); | ||
30 | 29 | ||
31 | void btrfs_tree_read_lock(struct extent_buffer *eb); | 30 | void btrfs_tree_read_lock(struct extent_buffer *eb); |
32 | void btrfs_tree_read_unlock(struct extent_buffer *eb); | 31 | void btrfs_tree_read_unlock(struct extent_buffer *eb); |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index aee4b1cc3d98..5471e47d6559 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes) | |||
1525 | 1525 | ||
1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && | 1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && |
1527 | qg->reserved + qg->rfer + num_bytes > | 1527 | qg->reserved + qg->rfer + num_bytes > |
1528 | qg->max_rfer) | 1528 | qg->max_rfer) { |
1529 | ret = -EDQUOT; | 1529 | ret = -EDQUOT; |
1530 | goto out; | ||
1531 | } | ||
1530 | 1532 | ||
1531 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && | 1533 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && |
1532 | qg->reserved + qg->excl + num_bytes > | 1534 | qg->reserved + qg->excl + num_bytes > |
1533 | qg->max_excl) | 1535 | qg->max_excl) { |
1534 | ret = -EDQUOT; | 1536 | ret = -EDQUOT; |
1537 | goto out; | ||
1538 | } | ||
1535 | 1539 | ||
1536 | list_for_each_entry(glist, &qg->groups, next_group) { | 1540 | list_for_each_entry(glist, &qg->groups, next_group) { |
1537 | ulist_add(ulist, glist->group->qgroupid, | 1541 | ulist_add(ulist, glist->group->qgroupid, |
1538 | (uintptr_t)glist->group, GFP_ATOMIC); | 1542 | (uintptr_t)glist->group, GFP_ATOMIC); |
1539 | } | 1543 | } |
1540 | } | 1544 | } |
1541 | if (ret) | ||
1542 | goto out; | ||
1543 | 1545 | ||
1544 | /* | 1546 | /* |
1545 | * no limits exceeded, now record the reservation into all qgroups | 1547 | * no limits exceeded, now record the reservation into all qgroups |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 9250b9c4f01e..50767bbaad6c 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -625,14 +625,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
625 | 625 | ||
626 | btrfs_trans_release_metadata(trans, root); | 626 | btrfs_trans_release_metadata(trans, root); |
627 | trans->block_rsv = NULL; | 627 | trans->block_rsv = NULL; |
628 | /* | ||
629 | * the same root has to be passed to start_transaction and | ||
630 | * end_transaction. Subvolume quota depends on this. | ||
631 | */ | ||
632 | WARN_ON(trans->root != root); | ||
633 | 628 | ||
634 | if (trans->qgroup_reserved) { | 629 | if (trans->qgroup_reserved) { |
635 | btrfs_qgroup_free(root, trans->qgroup_reserved); | 630 | /* |
631 | * the same root has to be passed here between start_transaction | ||
632 | * and end_transaction. Subvolume quota depends on this. | ||
633 | */ | ||
634 | btrfs_qgroup_free(trans->root, trans->qgroup_reserved); | ||
636 | trans->qgroup_reserved = 0; | 635 | trans->qgroup_reserved = 0; |
637 | } | 636 | } |
638 | 637 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6b9cff42265d..5989a92236f7 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -684,6 +684,12 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | |||
684 | __btrfs_close_devices(fs_devices); | 684 | __btrfs_close_devices(fs_devices); |
685 | free_fs_devices(fs_devices); | 685 | free_fs_devices(fs_devices); |
686 | } | 686 | } |
687 | /* | ||
688 | * Wait for rcu kworkers under __btrfs_close_devices | ||
689 | * to finish all blkdev_puts so device is really | ||
690 | * free when umount is done. | ||
691 | */ | ||
692 | rcu_barrier(); | ||
687 | return ret; | 693 | return ret; |
688 | } | 694 | } |
689 | 695 | ||