diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-26 08:26:58 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-26 08:26:58 -0700 | 
| commit | 019793b7554b18818624e9cf7a2ee8ba8cf6bda0 (patch) | |
| tree | ffe6ea833b4310d063a4a40435ba8877c396a303 /fs/btrfs/inode.c | |
| parent | cb49f577879519d1bff5898d9eec72dd441286cb (diff) | |
| parent | 7cf96da3ec7ca225acf4f284b0e904a1f5f98821 (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/btrfs/inode.c')
| -rw-r--r-- | fs/btrfs/inode.c | 20 | 
1 files changed, 13 insertions, 7 deletions
| 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,  			 1, 0, NULL, GFP_NOFS);  	while (start < end) {  		async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); +		BUG_ON(!async_cow);  		async_cow->inode = inode;  		async_cow->root = root;  		async_cow->locked_page = locked_page; @@ -4731,9 +4732,10 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,  	inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,  				dentry->d_name.len, dir->i_ino, objectid,  				BTRFS_I(dir)->block_group, mode, &index); -	err = PTR_ERR(inode); -	if (IS_ERR(inode)) +	if (IS_ERR(inode)) { +		err = PTR_ERR(inode);  		goto out_unlock; +	}  	err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);  	if (err) { @@ -4792,9 +4794,10 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,  	inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,  				dentry->d_name.len, dir->i_ino, objectid,  				BTRFS_I(dir)->block_group, mode, &index); -	err = PTR_ERR(inode); -	if (IS_ERR(inode)) +	if (IS_ERR(inode)) { +		err = PTR_ERR(inode);  		goto out_unlock; +	}  	err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);  	if (err) { @@ -4999,6 +5002,8 @@ static noinline int uncompress_inline(struct btrfs_path *path,  	inline_size = btrfs_file_extent_inline_item_len(leaf,  					btrfs_item_nr(leaf, path->slots[0]));  	tmp = kmalloc(inline_size, GFP_NOFS); +	if (!tmp) +		return -ENOMEM;  	ptr = btrfs_file_extent_inline_start(item);  	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,  	ret = btrfs_map_block(map_tree, READ, start_sector << 9,  			      &map_length, NULL, 0);  	if (ret) { -		bio_put(bio); +		bio_put(orig_bio);  		return -EIO;  	} @@ -7273,9 +7278,10 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,  				dentry->d_name.len, dir->i_ino, objectid,  				BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO,  				&index); -	err = PTR_ERR(inode); -	if (IS_ERR(inode)) +	if (IS_ERR(inode)) { +		err = PTR_ERR(inode);  		goto out_unlock; +	}  	err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);  	if (err) { | 
