aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJohann Lombardi <johann@whamcloud.com>2011-03-31 09:23:47 -0400
committerChris Mason <chris.mason@oracle.com>2011-04-05 01:19:42 -0400
commitb44c59a80ded004e1a82712e5f9e17b131c03221 (patch)
tree36588193bf5cc91d80d9d8376d5bad78f2babd0c /fs/btrfs/inode.c
parentfe3f566cd19bb6d787c92b2e202c85f929abf3ac (diff)
Btrfs: fix subvol_sem leak in btrfs_rename()
btrfs_rename() does not release the subvol_sem if the transaction failed to start. Signed-off-by: Johann Lombardi <johann@whamcloud.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 62ae9d5da806..1ca3e68586cf 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6961,8 +6961,10 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
6961 * should cover the worst case number of items we'll modify. 6961 * should cover the worst case number of items we'll modify.
6962 */ 6962 */
6963 trans = btrfs_start_transaction(root, 20); 6963 trans = btrfs_start_transaction(root, 20);
6964 if (IS_ERR(trans)) 6964 if (IS_ERR(trans)) {
6965 return PTR_ERR(trans); 6965 ret = PTR_ERR(trans);
6966 goto out_notrans;
6967 }
6966 6968
6967 btrfs_set_trans_block_group(trans, new_dir); 6969 btrfs_set_trans_block_group(trans, new_dir);
6968 6970
@@ -7062,7 +7064,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7062 } 7064 }
7063out_fail: 7065out_fail:
7064 btrfs_end_transaction_throttle(trans, root); 7066 btrfs_end_transaction_throttle(trans, root);
7065 7067out_notrans:
7066 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) 7068 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)
7067 up_read(&root->fs_info->subvol_sem); 7069 up_read(&root->fs_info->subvol_sem);
7068 7070