aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-04-26 11:26:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-26 11:26:58 -0400
commit019793b7554b18818624e9cf7a2ee8ba8cf6bda0 (patch)
treeffe6ea833b4310d063a4a40435ba8877c396a303 /fs
parentcb49f577879519d1bff5898d9eec72dd441286cb (diff)
parent7cf96da3ec7ca225acf4f284b0e904a1f5f98821 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: Btrfs: cleanup error handling in inode.c Btrfs: put the right bio if we have an error Btrfs: free bitmaps properly when evicting the cache Btrfs: Free free_space item properly in btrfs_trim_block_group() btrfs: add missing spin_unlock to a rare exit path Btrfs: check return value of kmalloc() btrfs: fix wrong allocating flag when reading page Btrfs: fix missing mutex_unlock in btrfs_del_dir_entries_in_log()
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c1
-rw-r--r--fs/btrfs/extent-tree.c4
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/btrfs/free-space-cache.c13
-rw-r--r--fs/btrfs/inode.c20
-rw-r--r--fs/btrfs/tree-log.c7
6 files changed, 32 insertions, 15 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 68c84c8c24bd..228cf36ece83 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2824,6 +2824,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
2824 2824
2825 spin_lock(&delayed_refs->lock); 2825 spin_lock(&delayed_refs->lock);
2826 if (delayed_refs->num_entries == 0) { 2826 if (delayed_refs->num_entries == 0) {
2827 spin_unlock(&delayed_refs->lock);
2827 printk(KERN_INFO "delayed_refs has NO entry\n"); 2828 printk(KERN_INFO "delayed_refs has NO entry\n");
2828 return ret; 2829 return ret;
2829 } 2830 }
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 31f33ba56fe8..cd52f7f556ef 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -8059,6 +8059,10 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root,
8059 u64 group_start = group->key.objectid; 8059 u64 group_start = group->key.objectid;
8060 new_extents = kmalloc(sizeof(*new_extents), 8060 new_extents = kmalloc(sizeof(*new_extents),
8061 GFP_NOFS); 8061 GFP_NOFS);
8062 if (!new_extents) {
8063 ret = -ENOMEM;
8064 goto out;
8065 }
8062 nr_extents = 1; 8066 nr_extents = 1;
8063 ret = get_new_locations(reloc_inode, 8067 ret = get_new_locations(reloc_inode,
8064 extent_key, 8068 extent_key,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 315138605088..ba41da59e31b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2681,7 +2681,7 @@ int extent_readpages(struct extent_io_tree *tree,
2681 prefetchw(&page->flags); 2681 prefetchw(&page->flags);
2682 list_del(&page->lru); 2682 list_del(&page->lru);
2683 if (!add_to_page_cache_lru(page, mapping, 2683 if (!add_to_page_cache_lru(page, mapping,
2684 page->index, GFP_KERNEL)) { 2684 page->index, GFP_NOFS)) {
2685 __extent_read_full_page(tree, page, get_extent, 2685 __extent_read_full_page(tree, page, get_extent,
2686 &bio, 0, &bio_flags); 2686 &bio, 0, &bio_flags);
2687 } 2687 }
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 11d2e9cea09e..63731a1fb0a1 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1768,10 +1768,13 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group)
1768 1768
1769 while ((node = rb_last(&block_group->free_space_offset)) != NULL) { 1769 while ((node = rb_last(&block_group->free_space_offset)) != NULL) {
1770 info = rb_entry(node, struct btrfs_free_space, offset_index); 1770 info = rb_entry(node, struct btrfs_free_space, offset_index);
1771 unlink_free_space(block_group, info); 1771 if (!info->bitmap) {
1772 if (info->bitmap) 1772 unlink_free_space(block_group, info);
1773 kfree(info->bitmap); 1773 kmem_cache_free(btrfs_free_space_cachep, info);
1774 kmem_cache_free(btrfs_free_space_cachep, info); 1774 } else {
1775 free_bitmap(block_group, info);
1776 }
1777
1775 if (need_resched()) { 1778 if (need_resched()) {
1776 spin_unlock(&block_group->tree_lock); 1779 spin_unlock(&block_group->tree_lock);
1777 cond_resched(); 1780 cond_resched();
@@ -2301,7 +2304,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group,
2301 start = entry->offset; 2304 start = entry->offset;
2302 bytes = min(entry->bytes, end - start); 2305 bytes = min(entry->bytes, end - start);
2303 unlink_free_space(block_group, entry); 2306 unlink_free_space(block_group, entry);
2304 kfree(entry); 2307 kmem_cache_free(btrfs_free_space_cachep, entry);
2305 } 2308 }
2306 2309
2307 spin_unlock(&block_group->tree_lock); 2310 spin_unlock(&block_group->tree_lock);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fcd66b6a8086..7cd8ab0ef04d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -954,6 +954,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
954 1, 0, NULL, GFP_NOFS); 954 1, 0, NULL, GFP_NOFS);
955 while (start < end) { 955 while (start < end) {
956 async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); 956 async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS);
957 BUG_ON(!async_cow);
957 async_cow->inode = inode; 958 async_cow->inode = inode;
958 async_cow->root = root; 959 async_cow->root = root;
959 async_cow->locked_page = locked_page; 960 async_cow->locked_page = locked_page;
@@ -4731,9 +4732,10 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4731 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 4732 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
4732 dentry->d_name.len, dir->i_ino, objectid, 4733 dentry->d_name.len, dir->i_ino, objectid,
4733 BTRFS_I(dir)->block_group, mode, &index); 4734 BTRFS_I(dir)->block_group, mode, &index);
4734 err = PTR_ERR(inode); 4735 if (IS_ERR(inode)) {
4735 if (IS_ERR(inode)) 4736 err = PTR_ERR(inode);
4736 goto out_unlock; 4737 goto out_unlock;
4738 }
4737 4739
4738 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); 4740 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
4739 if (err) { 4741 if (err) {
@@ -4792,9 +4794,10 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4792 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, 4794 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
4793 dentry->d_name.len, dir->i_ino, objectid, 4795 dentry->d_name.len, dir->i_ino, objectid,
4794 BTRFS_I(dir)->block_group, mode, &index); 4796 BTRFS_I(dir)->block_group, mode, &index);
4795 err = PTR_ERR(inode); 4797 if (IS_ERR(inode)) {
4796 if (IS_ERR(inode)) 4798 err = PTR_ERR(inode);
4797 goto out_unlock; 4799 goto out_unlock;
4800 }
4798 4801
4799 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); 4802 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
4800 if (err) { 4803 if (err) {
@@ -4999,6 +5002,8 @@ static noinline int uncompress_inline(struct btrfs_path *path,
4999 inline_size = btrfs_file_extent_inline_item_len(leaf, 5002 inline_size = btrfs_file_extent_inline_item_len(leaf,
5000 btrfs_item_nr(leaf, path->slots[0])); 5003 btrfs_item_nr(leaf, path->slots[0]));
5001 tmp = kmalloc(inline_size, GFP_NOFS); 5004 tmp = kmalloc(inline_size, GFP_NOFS);
5005 if (!tmp)
5006 return -ENOMEM;
5002 ptr = btrfs_file_extent_inline_start(item); 5007 ptr = btrfs_file_extent_inline_start(item);
5003 5008
5004 read_extent_buffer(leaf, tmp, ptr, inline_size); 5009 read_extent_buffer(leaf, tmp, ptr, inline_size);
@@ -6036,7 +6041,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip,
6036 ret = btrfs_map_block(map_tree, READ, start_sector << 9, 6041 ret = btrfs_map_block(map_tree, READ, start_sector << 9,
6037 &map_length, NULL, 0); 6042 &map_length, NULL, 0);
6038 if (ret) { 6043 if (ret) {
6039 bio_put(bio); 6044 bio_put(orig_bio);
6040 return -EIO; 6045 return -EIO;
6041 } 6046 }
6042 6047
@@ -7273,9 +7278,10 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7273 dentry->d_name.len, dir->i_ino, objectid, 7278 dentry->d_name.len, dir->i_ino, objectid,
7274 BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, 7279 BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO,
7275 &index); 7280 &index);
7276 err = PTR_ERR(inode); 7281 if (IS_ERR(inode)) {
7277 if (IS_ERR(inode)) 7282 err = PTR_ERR(inode);
7278 goto out_unlock; 7283 goto out_unlock;
7284 }
7279 7285
7280 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); 7286 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
7281 if (err) { 7287 if (err) {
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c50271ad3157..f997ec0c1ba4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2209,8 +2209,10 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
2209 2209
2210 log = root->log_root; 2210 log = root->log_root;
2211 path = btrfs_alloc_path(); 2211 path = btrfs_alloc_path();
2212 if (!path) 2212 if (!path) {
2213 return -ENOMEM; 2213 err = -ENOMEM;
2214 goto out_unlock;
2215 }
2214 2216
2215 di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, 2217 di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino,
2216 name, name_len, -1); 2218 name, name_len, -1);
@@ -2271,6 +2273,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
2271 } 2273 }
2272fail: 2274fail:
2273 btrfs_free_path(path); 2275 btrfs_free_path(path);
2276out_unlock:
2274 mutex_unlock(&BTRFS_I(dir)->log_mutex); 2277 mutex_unlock(&BTRFS_I(dir)->log_mutex);
2275 if (ret == -ENOSPC) { 2278 if (ret == -ENOSPC) {
2276 root->fs_info->last_trans_log_full_commit = trans->transid; 2279 root->fs_info->last_trans_log_full_commit = trans->transid;