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
This commit is contained in:
commit
08637024ab
7 changed files with 25 additions and 12 deletions
|
@ -1467,8 +1467,11 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
|
|||
if (ret && !insert) {
|
||||
err = -ENOENT;
|
||||
goto out;
|
||||
} else if (ret) {
|
||||
err = -EIO;
|
||||
WARN_ON(1);
|
||||
goto out;
|
||||
}
|
||||
BUG_ON(ret); /* Corruption */
|
||||
|
||||
leaf = path->nodes[0];
|
||||
item_size = btrfs_item_size_nr(leaf, path->slots[0]);
|
||||
|
|
|
@ -591,6 +591,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
|
|||
}
|
||||
compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags);
|
||||
clear_bit(EXTENT_FLAG_PINNED, &em->flags);
|
||||
clear_bit(EXTENT_FLAG_LOGGING, &flags);
|
||||
remove_extent_mapping(em_tree, em);
|
||||
if (no_splits)
|
||||
goto next;
|
||||
|
|
|
@ -2312,6 +2312,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
|
|||
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||
key.offset = start;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
if (merge) {
|
||||
struct btrfs_file_extent_item *fi;
|
||||
u64 extent_len;
|
||||
|
@ -2368,6 +2369,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
|
|||
|
||||
btrfs_mark_buffer_dirty(leaf);
|
||||
inode_add_bytes(inode, len);
|
||||
btrfs_release_path(path);
|
||||
|
||||
ret = btrfs_inc_extent_ref(trans, root, new->bytenr,
|
||||
new->disk_len, 0,
|
||||
|
@ -2381,6 +2383,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
|
|||
ret = 1;
|
||||
out_free_path:
|
||||
btrfs_release_path(path);
|
||||
path->leave_spinning = 0;
|
||||
btrfs_end_transaction(trans, root);
|
||||
out_unlock:
|
||||
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
void btrfs_tree_lock(struct extent_buffer *eb);
|
||||
void btrfs_tree_unlock(struct extent_buffer *eb);
|
||||
int btrfs_try_spin_lock(struct extent_buffer *eb);
|
||||
|
||||
void btrfs_tree_read_lock(struct extent_buffer *eb);
|
||||
void btrfs_tree_read_unlock(struct extent_buffer *eb);
|
||||
|
|
|
@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
|
|||
|
||||
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
|
||||
qg->reserved + qg->rfer + num_bytes >
|
||||
qg->max_rfer)
|
||||
qg->max_rfer) {
|
||||
ret = -EDQUOT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
|
||||
qg->reserved + qg->excl + num_bytes >
|
||||
qg->max_excl)
|
||||
qg->max_excl) {
|
||||
ret = -EDQUOT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_for_each_entry(glist, &qg->groups, next_group) {
|
||||
ulist_add(ulist, glist->group->qgroupid,
|
||||
(uintptr_t)glist->group, GFP_ATOMIC);
|
||||
}
|
||||
}
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* no limits exceeded, now record the reservation into all qgroups
|
||||
|
|
|
@ -625,14 +625,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
|
|||
|
||||
btrfs_trans_release_metadata(trans, root);
|
||||
trans->block_rsv = NULL;
|
||||
/*
|
||||
* the same root has to be passed to start_transaction and
|
||||
* end_transaction. Subvolume quota depends on this.
|
||||
*/
|
||||
WARN_ON(trans->root != root);
|
||||
|
||||
if (trans->qgroup_reserved) {
|
||||
btrfs_qgroup_free(root, trans->qgroup_reserved);
|
||||
/*
|
||||
* the same root has to be passed here between start_transaction
|
||||
* and end_transaction. Subvolume quota depends on this.
|
||||
*/
|
||||
btrfs_qgroup_free(trans->root, trans->qgroup_reserved);
|
||||
trans->qgroup_reserved = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -684,6 +684,12 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
|
|||
__btrfs_close_devices(fs_devices);
|
||||
free_fs_devices(fs_devices);
|
||||
}
|
||||
/*
|
||||
* Wait for rcu kworkers under __btrfs_close_devices
|
||||
* to finish all blkdev_puts so device is really
|
||||
* free when umount is done.
|
||||
*/
|
||||
rcu_barrier();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue